-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathExclusiveOrOpTest.h
More file actions
70 lines (49 loc) · 1.53 KB
/
ExclusiveOrOpTest.h
File metadata and controls
70 lines (49 loc) · 1.53 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
#define BOOST_TEST_MODULE ExclusiveOrOpTest
#include "../IntX.h"
#include "../Utils/Constants.h"
#include <vector>
#include <boost/test/included/unit_test.hpp>
BOOST_AUTO_TEST_SUITE(ExclusiveOrOpTest)
BOOST_AUTO_TEST_CASE(ShouldExclusiveOrTwoIntX)
{
IntX int1 = IntX(3);
IntX int2 = IntX(5);
IntX result = int1 ^ int2;
BOOST_CHECK(result == 6);
}
BOOST_AUTO_TEST_CASE(ShouldExclusiveOrPositiveAndNegativeIntX)
{
IntX int1 = IntX(-3);
IntX int2 = IntX(5);
IntX result = int1 ^ int2;
BOOST_CHECK(result == -6);
}
BOOST_AUTO_TEST_CASE(ShouldExclusiveOrTwoNegativeIntX)
{
IntX int1 = IntX(-3);
IntX int2 = IntX(-5);
IntX result = int1 ^ int2;
BOOST_CHECK(result == 6);
}
BOOST_AUTO_TEST_CASE(ShouldExclusiveOrIntXAndZero)
{
IntX int1 = IntX(3);
IntX int2 = IntX();
IntX result = int1 ^ int2;
BOOST_CHECK(result == int1);
}
BOOST_AUTO_TEST_CASE(ShouldExclusiveOrTwoBigIntX)
{
IntX int1 = IntX(vector<UInt32>({ 3, 5, Constants::MaxUInt32Value }), false);
IntX int2 = IntX(vector<UInt32>({ 1, 8, Constants::MaxUInt32Value }), false);
IntX result = int1 ^ int2;
BOOST_CHECK(result == IntX(vector<UInt32>({ 2, 13 }), false));
}
BOOST_AUTO_TEST_CASE(ShouldExclusiveOrTwoBigIntXOfDifferentLength)
{
IntX int1 = IntX(vector<UInt32>({ 3, 5, Constants::MaxUInt32Value, Constants::MaxUInt32Value }), false);
IntX int2 = IntX(vector<UInt32>({ 1, 8, Constants::MaxUInt32Value }), false);
IntX result = int1 ^ int2;
BOOST_CHECK(result == IntX(vector<UInt32>({ 2, 13, 0, Constants::MaxUInt32Value }), false));
}
BOOST_AUTO_TEST_SUITE_END()