-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_branch.cpp
More file actions
48 lines (44 loc) · 1000 Bytes
/
Copy pathtest_branch.cpp
File metadata and controls
48 lines (44 loc) · 1000 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
37
38
39
40
41
42
43
44
45
46
47
48
#include <gtest/gtest.h>
#include "Vbranch.h"
class VbranchTest : public ::testing::TestWithParam<std::tuple<int, bool>>
{
protected:
Vbranch *top = new Vbranch;
void SetUp() override
{
top->clk = 0;
top->eval();
top->clk = 1;
top->C = 1;
top->Z = 1;
top->N = 1;
}
void TearDown() override
{
delete top;
}
};
TEST_P(VbranchTest, HandlesBranch)
{
bool expected = std::get<1>(GetParam());
top->ctrl = std::get<0>(GetParam());
top->eval();
EXPECT_EQ(top->jmp, expected);
}
INSTANTIATE_TEST_SUITE_P(
VbranchTest,
VbranchTest,
::testing::Values(
std::make_tuple(0, false),
std::make_tuple(1, true),
std::make_tuple(2, true),
std::make_tuple(3, true),
std::make_tuple(4, true),
std::make_tuple(5, false),
std::make_tuple(6, false),
std::make_tuple(7, false)));
int main(int argc, char **argv, char **env)
{
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}