Skip to content

Commit b503d89

Browse files
committed
more test cases
1 parent 1ed8bb9 commit b503d89

File tree

6 files changed

+64
-0
lines changed

6 files changed

+64
-0
lines changed

test/122.act

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
namespace pfloat {
2+
function f(int<4> x) : int<3> {
3+
chp {
4+
self := int(x{0}, 3)
5+
}
6+
}
7+
8+
export
9+
defproc test() {
10+
int<15> x;
11+
chp {
12+
x := 123;
13+
log(f(x));
14+
log(int(7, 3) - f(x))
15+
}
16+
}
17+
}
18+
19+
defproc test()
20+
{
21+
pfloat::test t;
22+
}

test/123.act

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
namespace pfloat {
2+
export
3+
template<pint EXP,MAN>
4+
deftype float(int<1> sign; int<EXP> exponent; int<MAN> significand) {
5+
methods {
6+
function is_infinite() : bool {
7+
chp {
8+
self := exponent = (1 << EXP) - 1 & significand = 0
9+
}
10+
}
11+
12+
function is_finite() : bool {
13+
chp {
14+
// self := ~(exponent = (1 << EXP) - 1 & significand != 0)
15+
self := is_infinite()
16+
}
17+
}
18+
}
19+
}
20+
21+
export
22+
defproc test() {
23+
float<1,5> y;
24+
chp {
25+
y := float<1,5>(0);
26+
[ y.is_finite() -> log("here ")
27+
[] else -> log ("there ")
28+
]
29+
}
30+
}
31+
}
32+
33+
34+
defproc test()
35+
{
36+
pfloat::test t;
37+
}

test/runs/122.act.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
WARNING: test<>: substituting chp model (requested prs, not found)

test/runs/122.act.stdout

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[ 10] <t> 1
2+
[ 10] <t> 6

test/runs/123.act.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
WARNING: test<>: substituting chp model (requested prs, not found)

test/runs/123.act.stdout

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[ 10] <t> there

0 commit comments

Comments
 (0)