Skip to content

Commit

Permalink
[asl-tests] Import tests
Browse files Browse the repository at this point in the history
Modifications from patch:
1. Since PR #737, it is no longer a flagged error to give the name of a
   local variable from stdlib to a global variable in user program.
2. Test tree flattened
3. Change calls to println into print

Authored-by: Skye Aubrey <[email protected]>
Co-authored-by: Martin Ogden <[email protected]>
Committed-by: Luc Maranget <[email protected]>
Committed-by: Hadrien Renaud <[email protected]>

WIP

[asl] Fix tests to remove println

[asl] Fix tests to remove strange sed calls

[asl] Fixup some tests
  • Loading branch information
Skye Aubrey authored and HadrienRenaud committed May 2, 2024
1 parent 4fbccd1 commit a51be7b
Show file tree
Hide file tree
Showing 558 changed files with 9,569 additions and 0 deletions.
19 changes: 19 additions & 0 deletions asllib/tests/language.t/Dbhpj.asl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// RUN: interp %s | FileCheck %s

var _a: integer;

getter a[index: integer] => integer
begin
return _a;
end

setter a[index: integer] = value: integer
begin
_a = value;
return;
end

func main() => integer
begin
return 0;
end
8 changes: 8 additions & 0 deletions asllib/tests/language.t/Dbjny.asl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// RUN: interp %s | FileCheck %s

func main() => integer
begin
var a: integer = 10;
a = 4;
return 0;
end
10 changes: 10 additions & 0 deletions asllib/tests/language.t/Dbmgm.asl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// RUN: interp %s | FileCheck %s

func main() => integer
begin
var a : integer = 100;
var b : bits(1) = '0';
var c : integer{2, 16} = 16;
var d : bits({2, 16}) = '00';
return 0;
end
19 changes: 19 additions & 0 deletions asllib/tests/language.t/Dbtbr.asl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// RUN: not interp %s | FileCheck %s

type a of integer;
type b of a;

func testa(aa: a)
begin
pass;
end

func testa(bb: b)
begin
pass;
end

func main() => integer
begin
return 0;
end
11 changes: 11 additions & 0 deletions asllib/tests/language.t/Dbvgk.asl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// RUN: interp %s | FileCheck %s

func underconstrained(N: integer{}) => bits(N)
begin
return Zeros(N);
end

func main() => integer
begin
return 0;
end
11 changes: 11 additions & 0 deletions asllib/tests/language.t/Dcbqk.asl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// RUN: interp %s | FileCheck %s

func fixedanddetermined() => bits(10)
begin
return Zeros(10);
end

func main() => integer
begin
return 0;
end
32 changes: 32 additions & 0 deletions asllib/tests/language.t/Dccty.asl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// RUN: interp %s | FileCheck %s

var counter: integer = 0;
config width = 10;

func nonexecution(a: integer) => integer
begin
return 10;
end

func execution(a: integer) => integer
begin
counter = counter + a;
return counter;
end

func bitsfunc{N: integer}(a: bits(N)) => integer
begin
return 10;
end

func main() => integer
begin
let a = execution(10);
var t = 10;
let b = nonexecution(t);
let c = nonexecution(execution(10));
var tt = Zeros(width);
let d = bitsfunc(tt);

return 0;
end
12 changes: 12 additions & 0 deletions asllib/tests/language.t/Dcfyp.asl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// RUN: interp %s | FileCheck %s

func test(a: integer) => integer
begin
return a;
end

func main() => integer
begin
var a = test(10);
return 0;
end
9 changes: 9 additions & 0 deletions asllib/tests/language.t/Dcqxl.asl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// RUN: interp %s | FileCheck %s
// CHECK: 3.141590e+0

func main() => integer
begin
var a: real = 3.14159;
print(a);
return 0;
end
24 changes: 24 additions & 0 deletions asllib/tests/language.t/Dcsft.asl
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// RUN: interp %s | FileCheck %s

var counter: integer = 10;

func storage() => integer
begin
return counter;
end

func expression_func()
begin
counter = counter + 1;
end

func function() => integer
begin
expression_func();
return storage();
end

func main() => integer
begin
return 0;
end
10 changes: 10 additions & 0 deletions asllib/tests/language.t/Dcwvh.asl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// RUN: interp %s | FileCheck %s

constant x: integer = 10;
constant y: integer = x;
constant z: integer = x + y;

func main() => integer
begin
return 0;
end
8 changes: 8 additions & 0 deletions asllib/tests/language.t/Ddpxj.asl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// RUN: interp %s | FileCheck %s

type a of array[10] of integer;

func main() => integer
begin
return 0;
end
18 changes: 18 additions & 0 deletions asllib/tests/language.t/Dfxqv.asl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// RUN: interp %s | FileCheck %s

type T1 of integer; // the named type `T1` whose structure is integer
type T2 of (integer, T1); // the named type `T2` whose structure is (integer, integer)
// Note that (integer, T1) is non-primitive since it uses T1
var x: T1;
// the type of x is the named (hence non-primitive) type `T1`
// whose structure is `integer`
var y: integer;
// the type of y is the anonymous primitive type `integer`
var z: (integer, T1);
// the type of z is the anonymous non-primitive type `(integer, T1)`
// whose structure is `(integer, integer)`

func main() => integer
begin
return 0;
end
9 changes: 9 additions & 0 deletions asllib/tests/language.t/Dfxst.asl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// RUN: interp %s | FileCheck %s

func main() => integer
begin
let a = 10;
var b = 10;

return 0;
end
19 changes: 19 additions & 0 deletions asllib/tests/language.t/Dggcq.asl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// RUN: interp %s | FileCheck %s
// CHECK: 10

type a of exception{
aa: integer
};

func main() => integer
begin
try
throw a {
aa=10
};
catch
when aa : a => print(aa.aa);
end

return 0;
end
15 changes: 15 additions & 0 deletions asllib/tests/language.t/Dgvbk.asl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// RUN: interp %s | FileCheck %s

var a: integer = 10;

func test()
begin
a = a + 10;
end

type ty_test of array[10] of integer;

func main() => integer
begin
return 0;
end
11 changes: 11 additions & 0 deletions asllib/tests/language.t/Dgwwp.asl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// RUN: interp %s | FileCheck %s

func a() => integer
begin
return 10;
end

func main() => integer
begin
return 0;
end
10 changes: 10 additions & 0 deletions asllib/tests/language.t/Dgwxk.asl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// RUN: interp %s | FileCheck %s

type nonprimitive of integer;
type nonprimitive_a subtypes nonprimitive;
var primitive: integer;

func main() => integer
begin
return 0;
end
8 changes: 8 additions & 0 deletions asllib/tests/language.t/Dhbcp.asl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// RUN: interp %s | FileCheck %s

// ! Nothing to test here

func main() => integer
begin
return 0;
end
10 changes: 10 additions & 0 deletions asllib/tests/language.t/Dhlqc.asl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// RUN: interp %s | FileCheck %s

let x: integer = 10;
let y: integer = 10;
let z: integer = x + y + 10;

func main() => integer
begin
return 0;
end
11 changes: 11 additions & 0 deletions asllib/tests/language.t/Dhtpl.asl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// RUN: interp %s | FileCheck %s

func a()
begin
return;
end

func main() => integer
begin
return 0;
end
12 changes: 12 additions & 0 deletions asllib/tests/language.t/Djljd.asl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// RUN: interp %s | FileCheck %s

func execType(wid: integer{})
begin
// structure of R's type depends on execution time value `wid`
var R: bits(wid);
end

func main() => integer
begin
return 0;
end
8 changes: 8 additions & 0 deletions asllib/tests/language.t/Djrxm.asl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// RUN: interp %s | FileCheck %s

// ! Nothing to test here

func main() => integer
begin
return 0;
end
19 changes: 19 additions & 0 deletions asllib/tests/language.t/Djtdg.asl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// RUN: interp %s | FileCheck %s
// CHECK: 10

type a of exception{
aa: integer
};

func main() => integer
begin
try
throw a {
aa=10
};
catch
when aa : a => print(aa.aa);
end

return 0;
end
8 changes: 8 additions & 0 deletions asllib/tests/language.t/Djwkg.asl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// RUN: interp %s | FileCheck %s

// ! Nothing to test here

func main() => integer
begin
return 0;
end
8 changes: 8 additions & 0 deletions asllib/tests/language.t/Djwxx.asl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// RUN: interp %s | FileCheck %s

// ! Nothing to test

func main() => integer
begin
return 0;
end
22 changes: 22 additions & 0 deletions asllib/tests/language.t/Dkckx.asl
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// RUN: interp %s | FileCheck %s

func localassigns()
begin
var a = 0;
var b = 0;
end

func compiletimeexpressions()
begin
var a = 0 + 0 + 0 + 0 + 0;
end

func compiletimecalls()
begin
localassigns();
end

func main() => integer
begin
return 0;
end
Loading

0 comments on commit a51be7b

Please sign in to comment.