-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathglobal_manager_test.cpp
More file actions
executable file
·49 lines (39 loc) · 1.36 KB
/
global_manager_test.cpp
File metadata and controls
executable file
·49 lines (39 loc) · 1.36 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
#include "global_manager.h"
#include <gtest/gtest.h>
class GlobalManagerTest : public ::testing::Test {
protected:
void SetUp() override {
gm = std::make_unique<GlobalManager>();
}
void TearDown() override {
gm.reset();
}
std::unique_ptr<GlobalManager> gm;
};
TEST_F(GlobalManagerTest, TestIsFinish) {
EXPECT_TRUE(gm->IsFinish());
}
TEST_F(GlobalManagerTest, TestAddRequest) {
InterChiplet::AddrType sender = {0, 0};
InterChiplet::AddrType receiver = {1, 1};
std::string data = "Hello";
double senderClock = 100.0;
double frequency = 1.0;
InterChiplet::SyncCommType behavior = InterChiplet::SC_SEND;
gm->AddRequest(sender, receiver, data, senderClock, frequency, behavior);
EXPECT_FALSE(gm->IsFinish());
}
TEST_F(GlobalManagerTest, TestCheckPair) {
InterChiplet::AddrType sender = {0, 0};
InterChiplet::AddrType receiver = {1, 1};
std::string data = "Hello";
double senderClock = 100.0;
double frequency = 1.0;
gm->AddRequest(sender, receiver, data, senderClock, frequency, InterChiplet::SC_SEND);
gm->AddRequest(receiver, sender, data, senderClock, frequency, InterChiplet::SC_RECEIVE);
EXPECT_TRUE(gm->CheckPair());
}
int main(int argc, char **argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}