Skip to content

Commit

Permalink
reqiuire that most macros end with "!"
Browse files Browse the repository at this point in the history
  • Loading branch information
robertmuth committed Sep 14, 2023
1 parent 86ebdea commit 5027012
Show file tree
Hide file tree
Showing 27 changed files with 581 additions and 596 deletions.
56 changes: 28 additions & 28 deletions FrontEnd/LangTest/array_test.cw
Original file line number Diff line number Diff line change
Expand Up @@ -73,19 +73,19 @@
(index_val 3)]))
(let pa auto (& a))
(let pa_mut auto (& @mut a))
(test::AssertEq (at c4 2) 61_u8)
(test::AssertEq! (at c4 2) 61_u8)
(= c4 a)
(test::AssertEq (at c4 2) 3_u8)
(test::AssertEq! (at c4 2) 3_u8)
(= (at c4 2) 4_u8)
(= a c4)
(test::AssertEq (at a 2) 4_u8)
(test::AssertEq! (at a 2) 4_u8)

(test::AssertEq (at (. r1 u5) 1) 88_u8)
(test::AssertEq! (at (. r1 u5) 1) 88_u8)
(= (. r1 u5) a)
(test::AssertEq (at (. r1 u5) 1) 2_u8)
(test::AssertEq! (at (. r1 u5) 1) 2_u8)
(= (at (. r1 u5) 1) 111)
(= a (. r1 u5))
(test::AssertEq (at a 1) 111_u8)
(test::AssertEq! (at a 1) 111_u8)
)

(fun test_local_array [] void :
Expand All @@ -102,25 +102,25 @@
(let pa_mut auto (& @mut a))
(let pb auto (& b))

(test::AssertEq (at a 0) 1_u8)
(test::AssertEq (at b 2) 6_u8)
(test::AssertEq! (at a 0) 1_u8)
(test::AssertEq! (at b 2) 6_u8)
(= (at a 0) 6)
(test::AssertEq (at a 0) 6_u8)
(test::AssertEq! (at a 0) 6_u8)

(= (at (^ pa_mut) 2) 77_u8)
(test::AssertEq (at (^ pa) 2) 77_u8)
(test::AssertEq (at (^ pa_mut) 2) 77_u8)
(test::AssertEq! (at (^ pa) 2) 77_u8)
(test::AssertEq! (at (^ pa_mut) 2) 77_u8)

(test::AssertEq (at (^ pb) 0) 4_u8)
(test::AssertEq! (at (^ pb) 0) 4_u8)

(= (at (^ pa_mut) 0) 66)
(test::AssertEq (at a 0) 66_u8)
(test::AssertEq! (at a 0) 66_u8)

(= a b)
(test::AssertEq (at a 0) 4_u8)
(test::AssertEq (call update_array [a 0 2]) 4_u8)
(test::AssertEq (call update_array [a 0 3]) 2_u8)
(test::AssertEq (call update_array [(^ pa_mut) 0 2]) 3_u8)
(test::AssertEq! (at a 0) 4_u8)
(test::AssertEq! (call update_array [a 0 2]) 4_u8)
(test::AssertEq! (call update_array [a 0 3]) 2_u8)
(test::AssertEq! (call update_array [(^ pa_mut) 0 2]) 3_u8)
)


Expand Down Expand Up @@ -155,25 +155,25 @@

(fun test_global_array [] void :
@doc "basic"
(test::AssertEq (at c1 1) 2_s32)
(test::AssertEq (at c2 2) 3_s32)
(test::AssertEq (at e1 1) 22_s32)
(test::AssertEq (at e2 2) 333_s32)
(test::AssertEq (at f1 1) 22_s32)
(test::AssertEq (at f2 2) 333_s32)
(test::AssertEq (at f3 0) 111_s32)
(test::AssertEq! (at c1 1) 2_s32)
(test::AssertEq! (at c2 2) 3_s32)
(test::AssertEq! (at e1 1) 22_s32)
(test::AssertEq! (at e2 2) 333_s32)
(test::AssertEq! (at f1 1) 22_s32)
(test::AssertEq! (at f2 2) 333_s32)
(test::AssertEq! (at f3 0) 111_s32)
@doc "basic"
(test::AssertEq (at c3 0) 4_u8)
(test::AssertEq (call update_array [c3 0 77]) 4_u8)
(test::AssertEq (call update_array [c3 0 5]) 77_u8)
(test::AssertEq! (at c3 0) 4_u8)
(test::AssertEq! (call update_array [c3 0 77]) 4_u8)
(test::AssertEq! (call update_array [c3 0 5]) 77_u8)
)

(fun @cdecl main [(param argc s32) (param argv (ptr (ptr u8)))] s32 :
(stmt (call test_global_array []))
(stmt (call test_local_array []))
(stmt (call test_mixed_array []))
@doc "test end"
(test::Success)
(test::Success!)
(return 0))


Expand Down
26 changes: 13 additions & 13 deletions FrontEnd/LangTest/assign_test.cw
Original file line number Diff line number Diff line change
Expand Up @@ -53,37 +53,37 @@
(fun @cdecl main [(param argc s32) (param argv (ptr (ptr u8)))] s32 :
@doc "a1 u32"
(= (at ga1 3) 0x8765432187654321)
(test::AssertEq (at ga1 3) 0x8765432187654321_s64)
(test::AssertEq! (at ga1 3) 0x8765432187654321_s64)
(+= (at ga1 3) 0x1)
(test::AssertEq (at ga1 3) 0x8765432187654322_s64)
(test::AssertEq! (at ga1 3) 0x8765432187654322_s64)
@doc "gr1 s64"
(= (. gr1 i1) 0x8765432187654321)
(test::AssertEq (. gr1 i1) 0x8765432187654321_s64)
(test::AssertEq! (. gr1 i1) 0x8765432187654321_s64)
(+= (. gr1 i1) 0x1)
(test::AssertEq (. gr1 i1) 0x8765432187654322_s64)
(test::AssertEq! (. gr1 i1) 0x8765432187654322_s64)
@doc "gr1 u64"
(= (. gr1 i2) 0x1234567812345678)
(test::AssertEq (. gr1 i2) 0x1234567812345678_u64)
(test::AssertEq! (. gr1 i2) 0x1234567812345678_u64)
(-= (. gr1 i2) 0x1)
(test::AssertEq (. gr1 i2) 0x1234567812345677_u64)
(test::AssertEq! (. gr1 i2) 0x1234567812345677_u64)
@doc "gr1 u64 via pointer"
(= (. (^ (call get_addr [])) i2) 0x1234567812345678)
(test::AssertEq (. (^ (call get_addr [])) i2) 0x1234567812345678_u64)
(test::AssertEq! (. (^ (call get_addr [])) i2) 0x1234567812345678_u64)
(-= (. (^ (call get_addr [])) i2) 0x1)
(test::AssertEq (. (^ (call get_addr [])) i2) 0x1234567812345677_u64)
(test::AssertEq! (. (^ (call get_addr [])) i2) 0x1234567812345677_u64)
@doc "gar1 s64"
(= (. (at gar1 3) i1) 0x8765432187654321)
(test::AssertEq (. (at gar1 3) i1) 0x8765432187654321_s64)
(test::AssertEq! (. (at gar1 3) i1) 0x8765432187654321_s64)
@doc "gr2 s64"
(= (. (. gr2 t3) i1) 0x8765432187654321)
(test::AssertEq (. (. gr2 t3) i1) 0x8765432187654321_s64)
(test::AssertEq! (. (. gr2 t3) i1) 0x8765432187654321_s64)
(+= (. (. gr2 t3) i1) 0x1)
(test::AssertEq (. (. gr2 t3) i1) 0x8765432187654322_s64)
(test::AssertEq! (. (. gr2 t3) i1) 0x8765432187654322_s64)
@doc "gr2 u64"
(= (. (. gr2 t3) i2) 0x1234567812345678)
(test::AssertEq (. (. gr2 t3) i2) 0x1234567812345678_u64)
(test::AssertEq! (. (. gr2 t3) i2) 0x1234567812345678_u64)
@doc "test end"
(test::Success)
(test::Success!)
(return 0))

)
Expand Down
6 changes: 2 additions & 4 deletions FrontEnd/LangTest/defer_test.cw
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,8 @@

(fun @cdecl main [(param argc s32) (param argv (ptr (ptr u8)))] s32 :
(stmt (call foo []))
(test::AssertSliceEq (slice_val (front gSequence) gIndex) "abcdefgh")
(test::AssertSliceEq! (slice_val (front gSequence) gIndex) "abcdefgh")
@doc "test end"
(test::Success)
(test::Success!)
(return 0))
)


26 changes: 13 additions & 13 deletions FrontEnd/LangTest/enum_test.cw
Original file line number Diff line number Diff line change
Expand Up @@ -45,36 +45,36 @@
(let @mut v2 auto enum16::e3)
(let @mut v3 auto enum32::e4)

(test::AssertEq g1 enum8::e1)
(test::AssertEq g2 enum16::e2)
(test::AssertEq g3 enum32::e3)
(test::AssertEq! g1 enum8::e1)
(test::AssertEq! g2 enum16::e2)
(test::AssertEq! g3 enum32::e3)

(= g1 v1)
(= g2 v2)
(= g3 v3)

(test::AssertEq g1 enum8::e2)
(test::AssertEq g2 enum16::e3)
(test::AssertEq g3 enum32::e4)
(test::AssertEq! g1 enum8::e2)
(test::AssertEq! g2 enum16::e3)
(test::AssertEq! g3 enum32::e4)

(= v1 enum8::e3)
(= v2 enum16::e4)
(= v3 enum32::e1)

(test::AssertEq v1 enum8::e3)
(test::AssertEq v2 enum16::e4)
(test::AssertEq v3 enum32::e1)
(test::AssertEq! v1 enum8::e3)
(test::AssertEq! v2 enum16::e4)
(test::AssertEq! v3 enum32::e1)

(= (. gr1 s5) enum8::e3)
(= (. gr1 s6) enum16::e4)
(= (. gr1 s7) enum32::e1)

(test::AssertEq (. gr1 s5) enum8::e3)
(test::AssertEq (. gr1 s6) enum16::e4)
(test::AssertEq (. gr1 s7) enum32::e1)
(test::AssertEq! (. gr1 s5) enum8::e3)
(test::AssertEq! (. gr1 s6) enum16::e4)
(test::AssertEq! (. gr1 s7) enum32::e1)

@doc "test end"
(test::Success)
(test::Success!)
(return 0))

)
Loading

0 comments on commit 5027012

Please sign in to comment.