-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathBitwiseOrOpTest.h
More file actions
76 lines (58 loc) · 1.64 KB
/
BitwiseOrOpTest.h
File metadata and controls
76 lines (58 loc) · 1.64 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#define BOOST_TEST_MODULE BitwiseOrOpTest
#include "../IntX.h"
#include "../Utils/Constants.h"
#include <vector>
#include <boost/test/included/unit_test.hpp>
BOOST_AUTO_TEST_SUITE(BitwiseOrOpTest)
BOOST_AUTO_TEST_CASE(ShouldBitwiseOrTwoIntX)
{
IntX int1 = IntX(3);
IntX int2 = IntX(5);
IntX result = int1 | int2;
IntX result2 = int1 | 5;
IntX result3 = (IntX)3 | int2;
BOOST_CHECK(result == 7);
BOOST_CHECK(result == result2);
BOOST_CHECK(result2 == result3);
}
BOOST_AUTO_TEST_CASE(ShouldBitwiseOrPositiveAndNegativeIntX)
{
IntX int1 = IntX(-3);
IntX int2 = IntX(5);
IntX result = int1 | int2;
IntX result2 = int1 | 5;
IntX result3 = (IntX)-3 | int2;
BOOST_CHECK(result == -7);
BOOST_CHECK(result == result2);
BOOST_CHECK(result2 == result3);
}
BOOST_AUTO_TEST_CASE(ShouldBitwiseOrTwoNegativeIntX)
{
IntX int1 = IntX(-3);
IntX int2 = IntX(-5);
IntX result = int1 | int2;
IntX result2 = int1 | -5;
IntX result3 = (IntX)-3 | int2;
BOOST_CHECK(result == -7);
BOOST_CHECK(result == result2);
BOOST_CHECK(result2 == result3);
}
BOOST_AUTO_TEST_CASE(ShouldBitwiseOrIntXAndZero)
{
IntX int1 = IntX(3);
IntX int2 = IntX();
IntX result = int1 | int2;
IntX result2 = int1 | 0;
IntX result3 = (IntX)3 | int2;
BOOST_CHECK(result == int1);
BOOST_CHECK(result == result2);
BOOST_CHECK(result2 == result3);
}
BOOST_AUTO_TEST_CASE(ShouldBitwiseOrTwoBigIntX)
{
IntX int1 = IntX(vector<UInt32>({ 3, 5, Constants::MaxUInt32Value }), false);
IntX int2 = IntX(vector<UInt32>({ 1, 8 }), false);
IntX result = int1 | int2;
BOOST_CHECK(result == IntX(vector<UInt32>({ 3, 13, Constants::MaxUInt32Value }), false));
}
BOOST_AUTO_TEST_SUITE_END()