Skip to content

Commit 41ee7fc

Browse files
committed
Clean up tests
1 parent fdbb48e commit 41ee7fc

File tree

5 files changed

+22
-33
lines changed

5 files changed

+22
-33
lines changed

testsuite/bsc.lib/Prelude/AppendTuple.bs

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package AppendTuple where
22

3+
import CShow
4+
35
-- Test the AppendTuple type class
46

57
{-# verilog sysAppendTuple #-}
@@ -27,7 +29,7 @@ sysAppendTuple =
2729
t1 = (True, 42)
2830
let t2 :: (Bool, Int 8)
2931
t2 = appendTuple () t1
30-
$display "appendTuple((), (True, 42)) = (%b, %0d)" (tpl_1 t2) (tpl_2 t2)
32+
$display "appendTuple((), (True, 42)) = " (cshow t2)
3133
counter := counter + 1
3234

3335
"test2": when counter == 2 ==> action
@@ -36,7 +38,7 @@ sysAppendTuple =
3638
t1 = (False, negate 10)
3739
let t2 :: (Bool, Int 8)
3840
t2 = appendTuple t1 ()
39-
$display "appendTuple((False, -10), ()) = (%b, %0d)" (tpl_1 t2) (tpl_2 t2)
41+
$display "appendTuple((False, -10), ()) = " (cshow t2)
4042
counter := counter + 1
4143

4244
"test3": when counter == 3 ==> action
@@ -47,7 +49,7 @@ sysAppendTuple =
4749
t2 = (12, 0b101)
4850
let t4 :: (Bool, Int 8, UInt 4, Bit 3)
4951
t4 = appendTuple t1 t2
50-
$display "appendTuple((True, 5), (12, 0b101)) = (%b, %0d, %0d, %b)" (tpl_1 t4) (tpl_2 t4) (tpl_3 t4) (tpl_4 t4)
52+
$display "appendTuple((True, 5), (12, 0b101)) = " (cshow t4)
5153
counter := counter + 1
5254

5355
"test4": when counter == 4 ==> action
@@ -58,7 +60,7 @@ sysAppendTuple =
5860
t2 = (negate 3, 7)
5961
let t3 :: (Bool, Int 8, UInt 4)
6062
t3 = appendTuple b t2
61-
$display "appendTuple(False, (-3, 7)) = (%b, %0d, %0d)" (tpl_1 t3) (tpl_2 t3) (tpl_3 t3)
63+
$display "appendTuple(False, (-3, 7)) = " (cshow t3)
6264
counter := counter + 1
6365

6466
"test5": when counter == 5 ==> action
@@ -69,7 +71,7 @@ sysAppendTuple =
6971
b = 0b11010
7072
let t4 :: (Bool, Int 8, UInt 4, Bit 5)
7173
t4 = appendTuple t3 b
72-
$display "appendTuple((True, 20, 8), 0b11010) = (%b, %0d, %0d, %b)" (tpl_1 t4) (tpl_2 t4) (tpl_3 t4) (tpl_4 t4)
74+
$display "appendTuple((True, 20, 8), 0b11010) = " (cshow t4)
7375
counter := counter + 1
7476

7577
"test6": when counter == 6 ==> action
@@ -80,7 +82,7 @@ sysAppendTuple =
8082
t3 = (6, 0b111, negate 100)
8183
let t5 :: (Bool, Int 8, UInt 4, Bit 3, Int 16)
8284
t5 = appendTuple t2 t3
83-
$display "appendTuple((False, 15), (6, 0b111, -100)) = (%b, %0d, %0d, %b, %0d)" (tpl_1 t5) (tpl_2 t5) (tpl_3 t5) (tpl_4 t5) (tpl_5 t5)
85+
$display "appendTuple((False, 15), (6, 0b111, -100)) = " (cshow t5)
8486
$display ""
8587
$display "=== Testing splitTuple ==="
8688
counter := counter + 1
@@ -91,8 +93,7 @@ sysAppendTuple =
9193
t4 = (True, negate 15, 9, 0b110)
9294
let split :: ((Bool, Int 8), (UInt 4, Bit 3))
9395
split = splitTuple t4
94-
(t1, t2) = split
95-
$display "splitTuple((True, -15, 9, 0b110)) = ((%b, %0d), (%0d, %b))" (tpl_1 t1) (tpl_2 t1) (tpl_1 t2) (tpl_2 t2)
96+
$display "splitTuple((True, -15, 9, 0b110)) = " (cshow split)
9697
counter := counter + 1
9798

9899
"test8": when counter == 8 ==> action
@@ -101,8 +102,7 @@ sysAppendTuple =
101102
t3 = (False, 33, 15)
102103
let split :: (Bool, (Int 8, UInt 4))
103104
split = splitTuple t3
104-
(b, t2) = split
105-
$display "splitTuple((False, 33, 15)) = (%b, (%0d, %0d))" b (tpl_1 t2) (tpl_2 t2)
105+
$display "splitTuple((False, 33, 15)) = " (cshow split)
106106
counter := counter + 1
107107

108108
"test9": when counter == 9 ==> action
@@ -111,8 +111,7 @@ sysAppendTuple =
111111
t5 = (True, 50, 11, 0b001, negate 200)
112112
let split :: ((Bool, Int 8), (UInt 4, Bit 3, Int 16))
113113
split = splitTuple t5
114-
(t2, t3) = split
115-
$display "splitTuple((True, 50, 11, 0b001, -200)) = ((%b, %0d), (%0d, %b, %0d))" (tpl_1 t2) (tpl_2 t2) (tpl_1 t3) (tpl_2 t3) (tpl_3 t3)
114+
$display "splitTuple((True, 50, 11, 0b001, -200)) = " (cshow split)
116115
$display ""
117116
$display "=== Round-trip test ==="
118117
counter := counter + 1
@@ -127,8 +126,5 @@ sysAppendTuple =
127126
t4 = appendTuple t1 t2
128127
let split :: ((Bool, Int 8), (UInt 4, Bit 5))
129128
split = splitTuple t4
130-
(r1, r2) = split
131-
$display "appendTuple/splitTuple round-trip: ((%b, %0d), (%0d, %b))" (tpl_1 r1) (tpl_2 r1) (tpl_1 r2) (tpl_2 r2)
132-
$display ""
133-
$display "All AppendTuple tests passed"
129+
$display "appendTuple/splitTuple round-trip: " (cshow split)
134130
$finish 0

testsuite/bsc.lib/Prelude/TupleSize.bs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,4 @@ sysTupleSize = module
6666
t8 = (True, 0, 0, 0, 0, 0, 0, 0)
6767
let size8 = tupleSize t8
6868
$display "TupleSize of Tuple8 = %0d (expected 8)" size8
69-
70-
$display "All TupleSize type class tests passed"
7169
$finish 0
Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
=== Testing AppendTuple ===
22
appendTuple((), ()) = () [unit type]
3-
appendTuple((), (True, 42)) = (1, 42)
4-
appendTuple((False, -10), ()) = (0, -10)
5-
appendTuple((True, 5), (12, 0b101)) = (1, 5, 12, 101)
6-
appendTuple(False, (-3, 7)) = (0, -3, 7)
7-
appendTuple((True, 20, 8), 0b11010) = (1, 20, 8, 11010)
8-
appendTuple((False, 15), (6, 0b111, -100)) = (0, 15, 6, 111, -100)
3+
appendTuple((), (True, 42)) = (True, 42)
4+
appendTuple((False, -10), ()) = (False, -10)
5+
appendTuple((True, 5), (12, 0b101)) = (True, 5, 12, 0x5)
6+
appendTuple(False, (-3, 7)) = (False, -3, 7)
7+
appendTuple((True, 20, 8), 0b11010) = (True, 20, 8, 0x1a)
8+
appendTuple((False, 15), (6, 0b111, -100)) = (False, 15, 6, 0x7, -100)
99

1010
=== Testing splitTuple ===
11-
splitTuple((True, -15, 9, 0b110)) = ((1, -15), (9, 110))
12-
splitTuple((False, 33, 15)) = (0, (33, 15))
13-
splitTuple((True, 50, 11, 0b001, -200)) = ((1, 50), (11, 001, -200))
11+
splitTuple((True, -15, 9, 0b110)) = ((True, -15), 9, 0x6)
12+
splitTuple((False, 33, 15)) = (False, 33, 15)
13+
splitTuple((True, 50, 11, 0b001, -200)) = ((True, 50), 11, 0x1, -200)
1414

1515
=== Round-trip test ===
16-
appendTuple/splitTuple round-trip: ((1, 42), (13, 10101))
17-
18-
All AppendTuple tests passed
16+
appendTuple/splitTuple round-trip: ((True, 42), 13, 0x15)

testsuite/bsc.lib/Prelude/sysTupleSize.out.expected

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,3 @@ TupleSize of Tuple5 = 5 (expected 5)
88
TupleSize of Tuple6 = 6 (expected 6)
99
TupleSize of Tuple7 = 7 (expected 7)
1010
TupleSize of Tuple8 = 8 (expected 8)
11-
All TupleSize type class tests passed

testsuite/bsc.lib/vector/ConcatTuple.bs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,4 @@ sysConcatTuple =
135135
let v_restored :: Vector 3 (Bool, Int 8)
136136
v_restored = unconcatTuple t6
137137
$display "concatTuple/unconcatTuple round-trip (pairs): [(%b, %0d), (%b, %0d), (%b, %0d)]" (tpl_1 (v_restored !! 0)) (tpl_2 (v_restored !! 0)) (tpl_1 (v_restored !! 1)) (tpl_2 (v_restored !! 1)) (tpl_1 (v_restored !! 2)) (tpl_2 (v_restored !! 2))
138-
$display ""
139-
$display "All ConcatTuple tests passed"
140138
$finish 0

0 commit comments

Comments
 (0)