/* * CommandBus_test.cpp * * Created on: Mar 13, 2014 * Author: jonny */ #include #include #include "testUtils.h" #include "core/scheduling/ScheduledCommand.h" #include "core/Configuration.h" #include "core/ControllerState.h" #include "core/scheduling/CommandBus.h" using ::testing::_; using ::testing::AtLeast; using ::testing::Expectation; using namespace testing; using namespace std; namespace controller { TEST(CommandBusTest, cleanUpBusWorks) { Configuration config; ControllerState state(config.numberOfBanks); CommandBus bus(config, state); sc_time clk = config.Timings.clk; shared_ptr dummy = createDummyPayload(); ScheduledCommand cmd1(*dummy.get(), Command::Read, 2*clk, clk); ScheduledCommand cmd2(*dummy.get(), Command::Read, 3*clk, clk); ScheduledCommand cmd3(*dummy.get(), Command::Read, 5*clk, clk); ScheduledCommand cmd4(*dummy.get(), Command::Read, 7*clk, clk); bus.scheduleCommand(cmd1); bus.scheduleCommand(cmd2); bus.scheduleCommand(cmd3); bus.scheduleCommand(cmd4); EXPECT_EQ(4, bus.getPendingBusCommands().size()); bus.cleanUpBus(5*clk); EXPECT_EQ(2, bus.getPendingBusCommands().size()); } } /* namespace controller */