Skip to content

Commit

Permalink
move numeric.rs tests into tests/programs/ops.hvmc
Browse files Browse the repository at this point in the history
  • Loading branch information
enricozb committed Apr 6, 2024
1 parent 95420e4 commit fa5fe2c
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 146 deletions.
123 changes: 0 additions & 123 deletions tests/numeric.rs

This file was deleted.

47 changes: 32 additions & 15 deletions tests/programs/ops.hvmc
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,48 @@

@main = x
// underflow
& x ~ [n x] & #0 ~ <u8.- #1 n> // 255
& x ~ [n x] & #0 ~ <u16.- #1 n> // 65535
& x ~ [n x] & #0 ~ <u32.- #1 n> // 4294967295
& x ~ [n x] & #0 ~ <u60.- #1 n> // -1
& x ~ [n x] & #0 ~ <u8.- #1 n> // 255
& x ~ [n x] & #0 ~ <u16.- #1 n> // 65535
& x ~ [n x] & #0 ~ <u32.- #1 n> // 4294967295
& x ~ [n x] & #0 ~ <u60.- #1 n> // -1

// max
& x ~ [n x] & #1 ~ <u8.+ #254 n> // 255
& x ~ [n x] & #1 ~ <u16.+ #65534 n> // 65535
& x ~ [n x] & #1 ~ <u32.+ #4294967294 n> // 4294967295
& x ~ [n x] & #1 ~ <u60.+ #1152921504606846974 n> // -1
& x ~ [n x] & #1 ~ <u8.+ #254 n> // 255
& x ~ [n x] & #1 ~ <u16.+ #65534 n> // 65535
& x ~ [n x] & #1 ~ <u32.+ #4294967294 n> // 4294967295
& x ~ [n x] & #1 ~ <u60.+ #1152921504606846974 n> // -1

// overflow
& x ~ [n x] & #1 ~ <u8.+ #255 n> // 0
& x ~ [n x] & #1 ~ <u16.+ #65535 n> // 0
& x ~ [n x] & #1 ~ <u32.+ #4294967295 n> // 0
& x ~ [n x] & #1 ~ <u60.+ #1152921504606846975 n> // 0
& x ~ [n x] & #1 ~ <u8.+ #255 n> // 0
& x ~ [n x] & #1 ~ <u16.+ #65535 n> // 0
& x ~ [n x] & #1 ~ <u32.+ #4294967295 n> // 0
& x ~ [n x] & #1 ~ <u60.+ #1152921504606846975 n> // 0

// sign extension
& x ~ [n x] & #0 ~ <i8.- #1 n> // -1
& x ~ [n x] & #0 ~ <i16.- #1 n> // -1
& x ~ [n x] & #0 ~ <i32.- #1 n> // -1
& x ~ [n x] & #0 ~ <i8.- #1 n> // -1
& x ~ [n x] & #0 ~ <i16.- #1 n> // -1
& x ~ [n x] & #0 ~ <i32.- #1 n> // -1

// signed overflow
& x ~ [n x] & #2 ~ <i8.* #127 n> // -2
& x ~ [n x] & #2 ~ <i16.* #32767 n> // -2
& x ~ [n x] & #2 ~ <i32.* #2147483647 n> // -2

// all ops
& x ~ [n x] & #10 ~ <u32.+ #2 n> // 12
& x ~ [n x] & #10 ~ <u32.- #2 n> // 8
& x ~ [n x] & #10 ~ <u32.* #2 n> // 20
& x ~ [n x] & #10 ~ <u32./ #2 n> // 5
& x ~ [n x] & #10 ~ <u32.% #2 n> // 0
& x ~ [n x] & #10 ~ <u32.== #2 n> // 0
& x ~ [n x] & #10 ~ <u32.!= #2 n> // 1
& x ~ [n x] & #10 ~ <u32.< #2 n> // 0
& x ~ [n x] & #10 ~ <u32.> #2 n> // 1
& x ~ [n x] & #10 ~ <u32.& #2 n> // 2
& x ~ [n x] & #10 ~ <u32.| #2 n> // 10
& x ~ [n x] & #10 ~ <u32.^ #2 n> // 8
& x ~ [n x] & #10 ~ <u32.<< #2 n> // 40
& x ~ [n x] & #10 ~ <u32.>> #2 n> // 2
& x ~ [n x] & #9 ~ <u32./ #0 n> // 0

& x ~ *
8 changes: 4 additions & 4 deletions tests/snapshots/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ source: tests/tests.rs
expression: output
input_file: tests/programs/ops.hvmc
---
[#255 [#65535 [#4294967295 [#-1 [#255 [#65535 [#4294967295 [#-1 [#0 [#0 [#0 [#0 [#-1 [#-1 [#-1 [#-2 [#-2 [#-2 *]]]]]]]]]]]]]]]]]]
[#255 [#65535 [#4294967295 [#-1 [#255 [#65535 [#4294967295 [#-1 [#0 [#0 [#0 [#0 [#-1 [#-1 [#-1 [#-2 [#-2 [#-2 [#12 [#8 [#20 [#5 [#0 [#0 [#1 [#0 [#1 [#2 [#10 [#8 [#40 [#2 [#0 *]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
pre-reduce:
RWTS : 0
- ANNI : 0
Expand All @@ -12,9 +12,9 @@ RWTS : 0
- DREF : 0
- OPER : 0
run:
RWTS : 56
RWTS : 101
- ANNI : 0
- COMM : 0
- ERAS : 0
- DREF : 38
- OPER : 18
- DREF : 68
- OPER : 33
8 changes: 4 additions & 4 deletions tests/snapshots/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ source: tests/tests.rs
expression: output
input_file: tests/programs/ops.hvmc
---
[#255 [#65535 [#4294967295 [#-1 [#255 [#65535 [#4294967295 [#-1 [#0 [#0 [#0 [#0 [#-1 [#-1 [#-1 [#-2 [#-2 [#-2 *]]]]]]]]]]]]]]]]]]
RWTS : 56
[#255 [#65535 [#4294967295 [#-1 [#255 [#65535 [#4294967295 [#-1 [#0 [#0 [#0 [#0 [#-1 [#-1 [#-1 [#-2 [#-2 [#-2 [#12 [#8 [#20 [#5 [#0 [#0 [#1 [#0 [#1 [#2 [#10 [#8 [#40 [#2 [#0 *]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
RWTS : 101
- ANNI : 0
- COMM : 0
- ERAS : 0
- DREF : 38
- OPER : 18
- DREF : 68
- OPER : 33

0 comments on commit fa5fe2c

Please sign in to comment.