src/unit_test.cc
TEST(Minion,State_changes) { 
    Manager m;
    Minion elf;
    Minion goblin;
    std::vector<Minion*> _minions = {&elf,
                                    &goblin};

    Overlord ov(_minions);
    
    elf.set_target(make_tuple(2,2));
    goblin.set_target(make_tuple(30,30));

    m.schedule(ov, 100_ms)
     .schedule(elf, 100_ms)
     .schedule(goblin, 100_ms)
     .init()
     .start();

//start idle
EXPECT_EQ(elf.current().name(),"idle");//test idle
m.emit(Event("idle_select"));//emit check_idle
EXPECT_EQ(elf.current().name(),"idle");//test idle
elf.select();//select
m.emit(Event("idle_select"));//emit idle checck
EXPECT_EQ(elf.current().name(),"select");//test selected
m.emit(Event("select_travel"));//emit travel
EXPECT_EQ(elf.current().name(),"traveling");//test treaveling
elf.unselect();//unselcet
m.emit(Event("travel_select"));//emit travel sellect
EXPECT_EQ(elf.current().name(),"traveling");//test treaveling
m.emit(Event("travel_collide"));//emit colide
EXPECT_EQ(elf.current().name(),"traveling");//test traveling
elf.select_colide();//slect collide
m.emit(Event("travel_collide"));//emit collide
EXPECT_EQ(elf.current().name(),"colide");//test colide
m.emit(Event("collide_fight"));//emit emit fight
EXPECT_EQ(elf.current().name(),"fighting");//test fight

endwin();

    }
// More tests go here. You should aim to test every
// method of every object, either directly or indirectly,
// although testing user interfaces is notoriously 
// difficult.
More tests go here. You should aim to test every
method of every object, either directly or indirectly,
although testing user interfaces is notoriously
difficult.
More tests go here . You should aim to test every method of every object either directly or indirectly although testing user interfaces is notoriously difficult .
TEST(Minion,State_changes) { 
    Manager m;
    Minion elf;
    Minion goblin;
    std::vector<Minion*> _minions = {&elf,
                                    &goblin};
    Overlord ov(_minions);
    elf.set_target(make_tuple(2,2));
    goblin.set_target(make_tuple(30,30));
    m.schedule(ov, 100_ms)
     .schedule(elf, 100_ms)
     .schedule(goblin, 100_ms)
     .init()
     .start();
EXPECT_EQ(elf.current().name(),"idle");
m.emit(Event("idle_select"));
EXPECT_EQ(elf.current().name(),"idle");
elf.select();
m.emit(Event("idle_select"));
EXPECT_EQ(elf.current().name(),"select");
m.emit(Event("select_travel"));
EXPECT_EQ(elf.current().name(),"traveling");
elf.unselect();
m.emit(Event("travel_select")); sellect
EXPECT_EQ(elf.current().name(),"traveling");
m.emit(Event("travel_collide"));
EXPECT_EQ(elf.current().name(),"traveling");
elf.select_colide();
m.emit(Event("travel_collide"));
EXPECT_EQ(elf.current().name(),"colide");
m.emit(Event("collide_fight"));
EXPECT_EQ(elf.current().name(),"fighting");
endwin();
    }
TEST ( Minion , State_changes ) { Manager m ; Minion elf ; Minion goblin ; std :: vector < Minion * > _minions = { & elf , & goblin } ; Overlord ov ( _minions ) ; elf . set_target ( make_tuple ( 2 , 2 ) ) ; goblin . set_target ( make_tuple ( 30 , 30 ) ) ; m . schedule ( ov , 100 _ms ) . schedule ( elf , 100 _ms ) . schedule ( goblin , 100 _ms ) . init ( ) . start ( ) ; EXPECT_EQ ( elf . current ( ) . name ( ) , " " ) ; m . emit ( Event ( " " ) ) ; EXPECT_EQ ( elf . current ( ) . name ( ) , " " ) ; elf . select ( ) ; m . emit ( Event ( " " ) ) ; EXPECT_EQ ( elf . current ( ) . name ( ) , " " ) ; m . emit ( Event ( " " ) ) ; EXPECT_EQ ( elf . current ( ) . name ( ) , " " ) ; elf . unselect ( ) ; m . emit ( Event ( " " ) ) ; EXPECT_EQ ( elf . current ( ) . name ( ) , " " ) ; m . emit ( Event ( " " ) ) ; EXPECT_EQ ( elf . current ( ) . name ( ) , " " ) ; elf . select_colide ( ) ; m . emit ( Event ( " " ) ) ; EXPECT_EQ ( elf . current ( ) . name ( ) , " " ) ; m . emit ( Event ( " " ) ) ; EXPECT_EQ ( elf . current ( ) . name ( ) , " " ) ; endwin ( ) ; }
More tests go here.
More tests go here .
//start idle //test idle //emit check_idle //test idle //select //emit idle checck //test selected //emit travel //test treaveling //unselcet //emit travel sellect //test treaveling //emit colide //test traveling //slect collide //emit collide //test colide //emit emit fight //test fight