-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadder-test.ino
88 lines (71 loc) · 6.15 KB
/
adder-test.ino
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
77
78
79
80
81
82
83
84
85
86
87
88
#include "defines.h"
int adder_test() {
_setMode(HIGH, LOW, LOW);
_setInput(LOW , LOW , LOW , LOW , LOW ); if(!_checkOutput(LOW , LOW , LOW , _ADD)) return 1;
_setInput(LOW , LOW , LOW , LOW , HIGH); if(!_checkOutput(LOW , LOW , HIGH , _ADD)) return 1;
_setInput(LOW , LOW , LOW , HIGH, LOW ); if(!_checkOutput(LOW , HIGH, LOW , _ADD)) return 1;
_setInput(LOW , LOW , LOW , HIGH, HIGH); if(!_checkOutput(LOW , HIGH, HIGH , _ADD)) return 1;
_setInput(LOW , LOW , HIGH, LOW , LOW ); if(!_checkOutput(LOW , LOW , HIGH , _ADD)) return 1;
_setInput(LOW , LOW , HIGH, LOW , HIGH); if(!_checkOutput(LOW , HIGH, LOW , _ADD)) return 1;
_setInput(LOW , LOW , HIGH, HIGH, LOW ); if(!_checkOutput(LOW , HIGH, HIGH , _ADD)) return 1;
_setInput(LOW , LOW , HIGH, HIGH, HIGH); if(!_checkOutput(HIGH, LOW , LOW , _ADD)) return 1;
_setInput(LOW , HIGH, LOW , LOW , LOW ); if(!_checkOutput(LOW , HIGH, LOW , _ADD)) return 1;
_setInput(LOW , HIGH, LOW , LOW , HIGH); if(!_checkOutput(LOW , HIGH, HIGH , _ADD)) return 1;
_setInput(LOW , HIGH, LOW , HIGH, LOW ); if(!_checkOutput(HIGH, LOW , LOW , _ADD)) return 1;
_setInput(LOW , HIGH, LOW , HIGH, HIGH); if(!_checkOutput(HIGH, LOW , HIGH , _ADD)) return 1;
_setInput(LOW , HIGH, HIGH, LOW , LOW ); if(!_checkOutput(LOW , HIGH, HIGH , _ADD)) return 1;
_setInput(LOW , HIGH, HIGH, LOW , HIGH); if(!_checkOutput(HIGH, LOW , LOW , _ADD)) return 1;
_setInput(LOW , HIGH, HIGH, HIGH, LOW ); if(!_checkOutput(HIGH, LOW , HIGH , _ADD)) return 1;
_setInput(LOW , HIGH, HIGH, HIGH, HIGH); if(!_checkOutput(HIGH, HIGH, LOW , _ADD)) return 1;
_setInput(HIGH, LOW , LOW , LOW , LOW ); if(!_checkOutput(LOW , LOW , HIGH , _ADD)) return 1;
_setInput(HIGH, LOW , LOW , LOW , HIGH); if(!_checkOutput(LOW , HIGH, LOW , _ADD)) return 1;
_setInput(HIGH, LOW , LOW , HIGH, LOW ); if(!_checkOutput(LOW , HIGH, HIGH , _ADD)) return 1;
_setInput(HIGH, LOW , LOW , HIGH, HIGH); if(!_checkOutput(HIGH, LOW , LOW , _ADD)) return 1;
_setInput(HIGH, LOW , HIGH, LOW , LOW ); if(!_checkOutput(LOW , HIGH, LOW , _ADD)) return 1;
_setInput(HIGH, LOW , HIGH, LOW , HIGH); if(!_checkOutput(LOW , HIGH, HIGH , _ADD)) return 1;
_setInput(HIGH, LOW , HIGH, HIGH, LOW ); if(!_checkOutput(HIGH, LOW , LOW , _ADD)) return 1;
_setInput(HIGH, LOW , HIGH, HIGH, HIGH); if(!_checkOutput(HIGH, LOW , HIGH , _ADD)) return 1;
_setInput(HIGH, HIGH, LOW , LOW , LOW ); if(!_checkOutput(LOW , HIGH, HIGH , _ADD)) return 1;
_setInput(HIGH, HIGH, LOW , LOW , HIGH); if(!_checkOutput(HIGH, LOW , LOW , _ADD)) return 1;
_setInput(HIGH, HIGH, LOW , HIGH, LOW ); if(!_checkOutput(HIGH, LOW , HIGH , _ADD)) return 1;
_setInput(HIGH, HIGH, LOW , HIGH, HIGH); if(!_checkOutput(HIGH, HIGH, LOW , _ADD)) return 1;
_setInput(HIGH, HIGH, HIGH, LOW , LOW ); if(!_checkOutput(HIGH, LOW , LOW , _ADD)) return 1;
_setInput(HIGH, HIGH, HIGH, LOW , HIGH); if(!_checkOutput(HIGH, LOW , HIGH , _ADD)) return 1;
_setInput(HIGH, HIGH, HIGH, HIGH, LOW ); if(!_checkOutput(HIGH, HIGH, LOW , _ADD)) return 1;
_setInput(HIGH, HIGH, HIGH, HIGH, HIGH); if(!_checkOutput(HIGH, HIGH, HIGH , _ADD)) return 1;
// minus
_setMode(HIGH, LOW, HIGH);
_setInput(LOW , LOW , LOW , LOW , LOW ); if(!_checkOutput(LOW , HIGH, HIGH , _SUB)) return 1;
_setInput(LOW , LOW , LOW , LOW , HIGH); if(!_checkOutput(LOW , HIGH, LOW , _SUB)) return 1;
_setInput(LOW , LOW , LOW , HIGH, LOW ); if(!_checkOutput(LOW , LOW , HIGH , _SUB)) return 1;
_setInput(LOW , LOW , LOW , HIGH, HIGH); if(!_checkOutput(LOW , LOW , LOW , _SUB)) return 1;
_setInput(LOW , LOW , HIGH, LOW , LOW ); if(!_checkOutput(HIGH, LOW , LOW , _SUB)) return 1;
_setInput(LOW , LOW , HIGH, LOW , HIGH); if(!_checkOutput(LOW , HIGH, HIGH , _SUB)) return 1;
_setInput(LOW , LOW , HIGH, HIGH, LOW ); if(!_checkOutput(LOW , HIGH, LOW , _SUB)) return 1;
_setInput(LOW , LOW , HIGH, HIGH, HIGH); if(!_checkOutput(LOW , LOW , HIGH , _SUB)) return 1;
_setInput(LOW , HIGH, LOW , LOW , LOW ); if(!_checkOutput(HIGH, LOW , HIGH , _SUB)) return 1;
_setInput(LOW , HIGH, LOW , LOW , HIGH); if(!_checkOutput(HIGH, LOW , LOW , _SUB)) return 1;
_setInput(LOW , HIGH, LOW , HIGH, LOW ); if(!_checkOutput(LOW , HIGH, HIGH , _SUB)) return 1;
_setInput(LOW , HIGH, LOW , HIGH, HIGH); if(!_checkOutput(LOW , HIGH, LOW , _SUB)) return 1;
_setInput(LOW , HIGH, HIGH, LOW , LOW ); if(!_checkOutput(HIGH, HIGH, LOW , _SUB)) return 1;
_setInput(LOW , HIGH, HIGH, LOW , HIGH); if(!_checkOutput(HIGH, LOW , HIGH , _SUB)) return 1;
_setInput(LOW , HIGH, HIGH, HIGH, LOW ); if(!_checkOutput(HIGH, LOW , LOW , _SUB)) return 1;
_setInput(LOW , HIGH, HIGH, HIGH, HIGH); if(!_checkOutput(LOW , HIGH, HIGH , _SUB)) return 1;
_setInput(HIGH, LOW , LOW , LOW , LOW ); if(!_checkOutput(HIGH, LOW , LOW , _SUB)) return 1;
_setInput(HIGH, LOW , LOW , LOW , HIGH); if(!_checkOutput(LOW , HIGH, HIGH , _SUB)) return 1;
_setInput(HIGH, LOW , LOW , HIGH, LOW ); if(!_checkOutput(LOW , HIGH, LOW , _SUB)) return 1;
_setInput(HIGH, LOW , LOW , HIGH, HIGH); if(!_checkOutput(LOW , LOW , HIGH , _SUB)) return 1;
_setInput(HIGH, LOW , HIGH, LOW , LOW ); if(!_checkOutput(HIGH, LOW , HIGH , _SUB)) return 1;
_setInput(HIGH, LOW , HIGH, LOW , HIGH); if(!_checkOutput(HIGH, LOW , LOW , _SUB)) return 1;
_setInput(HIGH, LOW , HIGH, HIGH, LOW ); if(!_checkOutput(LOW , HIGH, HIGH , _SUB)) return 1;
_setInput(HIGH, LOW , HIGH, HIGH, HIGH); if(!_checkOutput(LOW , HIGH, LOW , _SUB)) return 1;
_setInput(HIGH, HIGH, LOW , LOW , LOW ); if(!_checkOutput(HIGH, HIGH, LOW , _SUB)) return 1;
_setInput(HIGH, HIGH, LOW , LOW , HIGH); if(!_checkOutput(HIGH, LOW , HIGH , _SUB)) return 1;
_setInput(HIGH, HIGH, LOW , HIGH, LOW ); if(!_checkOutput(HIGH, LOW , LOW , _SUB)) return 1;
_setInput(HIGH, HIGH, LOW , HIGH, HIGH); if(!_checkOutput(LOW , HIGH, HIGH , _SUB)) return 1;
_setInput(HIGH, HIGH, HIGH, LOW , LOW ); if(!_checkOutput(HIGH, HIGH, HIGH , _SUB)) return 1;
_setInput(HIGH, HIGH, HIGH, LOW , HIGH); if(!_checkOutput(HIGH, HIGH, LOW , _SUB)) return 1;
_setInput(HIGH, HIGH, HIGH, HIGH, LOW ); if(!_checkOutput(HIGH, LOW , HIGH , _SUB)) return 1;
_setInput(HIGH, HIGH, HIGH, HIGH, HIGH); if(!_checkOutput(HIGH, LOW , LOW , _SUB)) return 1;
return 0;
}