Skip to content

Commit

Permalink
Add tests for unstable proc sgn / bigint.sgn
Browse files Browse the repository at this point in the history
---
Signed-off-by: Michael Ferguson <[email protected]>
  • Loading branch information
mppf committed Mar 11, 2024
1 parent a9d4865 commit 4f7cbb3
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/unstable/BigInteger/unstable-sgn-bigint.chpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
use BigInteger;

// bigint
var b = new bigint(1);
assert(b.sgn() == 1);
1 change: 1 addition & 0 deletions test/unstable/BigInteger/unstable-sgn-bigint.good
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
unstable-sgn-bigint.chpl:5: warning: bigint.sgn is unstable and may change its name and return type in the future
48 changes: 48 additions & 0 deletions test/unstable/unstable-sgn.chpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// non-param numeric types
var i8: int(8) = 1;
var i16: int(16) = 1;
var i32: int(32) = 1;
var i64: int(64) = 1;
assert(sgn(i8) == 1);
assert(sgn(i16) == 1);
assert(sgn(i32) == 1);
assert(sgn(i64) == 1);

var u8: uint(8) = 1;
var u16: uint(16) = 1;
var u32: uint(32) = 1;
var u64: uint(64) = 1;
assert(sgn(u8) == 1);
assert(sgn(u16) == 1);
assert(sgn(u32) == 1);
assert(sgn(u64) == 1);

var r32: real(32) = 1;
var r64: real(64) = 1;
assert(sgn(r32) == 1);
assert(sgn(r64) == 1);


// param numeric types
param pi8: int(8) = 1;
param pi16: int(16) = 1;
param pi32: int(32) = 1;
param pi64: int(64) = 1;
assert(sgn(pi8) == 1);
assert(sgn(pi16) == 1);
assert(sgn(pi32) == 1);
assert(sgn(pi64) == 1);

param pu8: uint(8) = 1;
param pu16: uint(16) = 1;
param pu32: uint(32) = 1;
param pu64: uint(64) = 1;
assert(sgn(pu8) == 1);
assert(sgn(pu16) == 1);
assert(sgn(pu32) == 1);
assert(sgn(pu64) == 1);

param pr32: real(32) = 1;
param pr64: real(64) = 1;
assert(sgn(pr32) == 1);
assert(sgn(pr64) == 1);
20 changes: 20 additions & 0 deletions test/unstable/unstable-sgn.good
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
unstable-sgn.chpl:6: warning: sgn is unstable and may change its name and return type in the future
unstable-sgn.chpl:7: warning: sgn is unstable and may change its name and return type in the future
unstable-sgn.chpl:8: warning: sgn is unstable and may change its name and return type in the future
unstable-sgn.chpl:9: warning: sgn is unstable and may change its name and return type in the future
unstable-sgn.chpl:15: warning: sgn is unstable and may change its name and return type in the future
unstable-sgn.chpl:16: warning: sgn is unstable and may change its name and return type in the future
unstable-sgn.chpl:17: warning: sgn is unstable and may change its name and return type in the future
unstable-sgn.chpl:18: warning: sgn is unstable and may change its name and return type in the future
unstable-sgn.chpl:22: warning: sgn is unstable and may change its name and return type in the future
unstable-sgn.chpl:23: warning: sgn is unstable and may change its name and return type in the future
unstable-sgn.chpl:31: warning: sgn is unstable and may change its name and return type in the future
unstable-sgn.chpl:32: warning: sgn is unstable and may change its name and return type in the future
unstable-sgn.chpl:33: warning: sgn is unstable and may change its name and return type in the future
unstable-sgn.chpl:34: warning: sgn is unstable and may change its name and return type in the future
unstable-sgn.chpl:40: warning: sgn is unstable and may change its name and return type in the future
unstable-sgn.chpl:41: warning: sgn is unstable and may change its name and return type in the future
unstable-sgn.chpl:42: warning: sgn is unstable and may change its name and return type in the future
unstable-sgn.chpl:43: warning: sgn is unstable and may change its name and return type in the future
unstable-sgn.chpl:47: warning: sgn is unstable and may change its name and return type in the future
unstable-sgn.chpl:48: warning: sgn is unstable and may change its name and return type in the future

0 comments on commit 4f7cbb3

Please sign in to comment.