-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathtest_cmd_handler.cpp
More file actions
36 lines (32 loc) · 915 Bytes
/
test_cmd_handler.cpp
File metadata and controls
36 lines (32 loc) · 915 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include "cmd_handler.h"
#include "global_manager.h"
#include <gtest/gtest.h>
class CmdHandlerTest : public ::testing::Test {
protected:
GlobalManager gm;
void SetUp() override {
gm = GlobalManager();
}
};
TEST_F(CmdHandlerTest, TestHandleSendCmd) {
InterChiplet::SyncCommand cmd;
cmd.m_type = InterChiplet::SC_SEND;
cmd.m_src = {"Sim1"};
cmd.m_dst = {"Sim2"};
cmd.m_cycle = 10.0;
cmd.m_clock_rate = 1.0;
cmd.m_nbytes = 100;
handle_send_cmd(cmd, &gm);
EXPECT_EQ(gm.requestList.size(), 1);
}
TEST_F(CmdHandlerTest, TestHandleReceiveCmd) {
InterChiplet::SyncCommand cmd;
cmd.m_type = InterChiplet::SC_RECEIVE;
cmd.m_src = {"Sim2"};
cmd.m_dst = {"Sim1"};
cmd.m_cycle = 10.0;
cmd.m_clock_rate = 1.0;
cmd.m_nbytes = 100;
handle_receive_cmd(cmd, &gm);
EXPECT_EQ(gm.requestList.size(), 1);
}