Skip to content

Commit a3bb49d

Browse files
committed
test: Use casts in example programs
Re-enable OP_CAT; yay. jet_complement_1 is kind of a bitch to use because its input and output are `u1`. It is from the multi_bit_logic module where every jet works on `uN` for some bit width `N`. At the same, jet_complement_1 is effectively the negation jet. jet_negate_1 doesn't exist. I will add special syntax for boolean operations in a future PR. Until then, we have to cast incoming bits as well as outgoing bits.
1 parent e2f1920 commit a3bb49d

File tree

3 files changed

+4
-9
lines changed

3 files changed

+4
-9
lines changed

example_progs/cat.simf

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
fn main() {
2-
let a: u8 = 0x10;
3-
let b: u8 = 0x01;
4-
let ab: u16 = (a, b);
2+
let ab: u16 = <(u8, u8)>::into((0x10, 0x01));
53
let c: u16 = 0x1001;
64
jet_verify(jet_eq_16(ab, c));
7-
let a: u4 = 0b1011;
8-
let b: u4 = 0b1101;
9-
let ab: u8 = (a, b);
5+
let ab: u8 = <(u4, u4)>::into((0b1011, 0b1101));
106
let c: u8 = 0b10111101;
117
jet_verify(jet_eq_8(ab, c));
128
}

example_progs/function.simf

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
fn checked_add_32(a: u32, b: u32) -> u32 {
22
let (carry, sum): (bool, u32) = jet_add_32(a, b);
3-
// FIXME: Need to cast `bool` to `u1`
4-
// jet_verify(jet_complement_1(carry));
3+
jet_verify(<u1>::into(jet_complement_1(<bool>::into(carry))));
54
sum
65
}
76

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ mod tests {
6666
("add.simf", "empty.wit"),
6767
("add.simf", "empty.wit"),
6868
("array.simf", "empty.wit"),
69-
// ("cat.simf", "empty.wit"),
69+
("cat.simf", "empty.wit"),
7070
(
7171
"checksigfromstackverify.simf",
7272
"checksigfromstackverify.wit",

0 commit comments

Comments
 (0)