ONGOING: Test programs
This commit is contained in:
15
test_programs/riscv_instructions/boolean_logic/comparisons.c
Normal file
15
test_programs/riscv_instructions/boolean_logic/comparisons.c
Normal file
@ -0,0 +1,15 @@
|
||||
int main() {
|
||||
int x = 0;
|
||||
int y = 1;
|
||||
while (x <= y) {
|
||||
if (x > y) {
|
||||
x += 1;
|
||||
} else if (x == y) {
|
||||
x += y;
|
||||
} else if (x < y) {
|
||||
y += 1;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
10
test_programs/riscv_instructions/boolean_logic/if.c
Normal file
10
test_programs/riscv_instructions/boolean_logic/if.c
Normal file
@ -0,0 +1,10 @@
|
||||
int main() {
|
||||
int x = 1;
|
||||
if (x == 1 && x > 0) {
|
||||
x = 2;
|
||||
} else if (x || x == 0 ) {
|
||||
x = 3;
|
||||
} else {
|
||||
x = 0;
|
||||
}
|
||||
}
|
7
test_programs/riscv_instructions/boolean_logic/switch.c
Normal file
7
test_programs/riscv_instructions/boolean_logic/switch.c
Normal file
@ -0,0 +1,7 @@
|
||||
int main() {
|
||||
int x = 0;
|
||||
switch(1) {
|
||||
case 1: x = 1; break;
|
||||
default: return;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user