mirror of
https://github.com/ProgramSnail/Lama.git
synced 2025-12-05 22:38:44 +00:00
Moved x86only tests into stdlib/regression
This commit is contained in:
parent
e4b34a3ec1
commit
eeab48ed33
39 changed files with 10 additions and 59 deletions
|
|
@ -1,6 +1,6 @@
|
|||
HashTab internal structure: MNode (-624426958, {[{1, 2, 3}, 100]}, 0, 0, 0)
|
||||
HashTab internal structure: MNode (-624426958, {[{1, 2, 3}, 200], [{1, 2, 3}, 100]}, 0, 0, 0)
|
||||
Searching: Some (100)
|
||||
Searching: Some (200)
|
||||
Searching: Some (200)
|
||||
Replaced: Some (800)
|
||||
Restored: Some (100)
|
||||
Restored: Some (200)
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
12
stdlib/regression/orig/test20.log
Normal file
12
stdlib/regression/orig/test20.log
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
Empty
|
||||
Node (0, Empty, Empty)
|
||||
Node (0, Empty, Node (1, Empty, Empty))
|
||||
Node (0, Empty, Node (1, Empty, Node (2, Empty, Empty)))
|
||||
Node (0, Empty, Node (1, Empty, Node (2, Empty, Node (3, Empty, Empty))))
|
||||
Node (0, Empty, Node (1, Empty, Node (2, Empty, Node (3, Empty, Node (4, Empty, Empty)))))
|
||||
Node (0, Empty, Node (1, Empty, Node (2, Empty, Node (3, Empty, Node (4, Empty, Node (5, Empty, Empty))))))
|
||||
Node (0, Empty, Node (1, Empty, Node (2, Empty, Node (3, Empty, Node (4, Empty, Node (5, Empty, Node (6, Empty, Empty)))))))
|
||||
Node (0, Empty, Node (1, Empty, Node (2, Empty, Node (3, Empty, Node (4, Empty, Node (5, Empty, Node (6, Empty, Node (7, Empty, Empty))))))))
|
||||
Node (0, Empty, Node (1, Empty, Node (2, Empty, Node (3, Empty, Node (4, Empty, Node (5, Empty, Node (6, Empty, Node (7, Empty, Node (8, Empty, Empty)))))))))
|
||||
Node (0, Empty, Node (1, Empty, Node (2, Empty, Node (3, Empty, Node (4, Empty, Node (5, Empty, Node (6, Empty, Node (7, Empty, Node (8, Empty, Node (9, Empty, Empty))))))))))
|
||||
Node (0, Empty, Node (1, Empty, Node (2, Empty, Node (3, Empty, Node (4, Empty, Node (5, Empty, Node (6, Empty, Node (7, Empty, Node (8, Empty, Node (9, Empty, Node (10, Empty, Empty)))))))))))
|
||||
9
stdlib/regression/orig/test21.log
Normal file
9
stdlib/regression/orig/test21.log
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
1
|
||||
2
|
||||
3
|
||||
100
|
||||
Cons (3, Cons (2, Cons (1, Cons (6, Cons (5, Cons (4, Cons (3, Cons (2, Cons (1, Nil)))))))))
|
||||
4
stdlib/regression/orig/test22.log
Normal file
4
stdlib/regression/orig/test22.log
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
0
|
||||
{1, 2, 3, 4}
|
||||
{{1}, {2, 3}, {4, {5, 6}}}
|
||||
{1, 2, 3, 4}
|
||||
3
stdlib/regression/orig/test23.log
Normal file
3
stdlib/regression/orig/test23.log
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
1
|
||||
{2, 3, 4}
|
||||
2
|
||||
3
stdlib/regression/orig/test24.log
Normal file
3
stdlib/regression/orig/test24.log
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
3
|
||||
{1}
|
||||
{1}
|
||||
5
stdlib/regression/orig/test25.log
Normal file
5
stdlib/regression/orig/test25.log
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
Cloning int: 5
|
||||
Cloning string: abc
|
||||
Cloning array: [1, 2, 3, 4, 5]
|
||||
Cloning sexp: A (1, 2, 3, 4, 5)
|
||||
Cloning closure: address ok, 5, 6
|
||||
2
stdlib/regression/orig/test26.log
Normal file
2
stdlib/regression/orig/test26.log
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
Number of commands-line arguments: 1
|
||||
arg [0 ] = "./test26"
|
||||
|
|
@ -16,4 +16,4 @@ local a = token ("a"),
|
|||
exp = expr ({[Left, {add, sub}], [Left, {mul, div}]}, a) (id),
|
||||
i;
|
||||
|
||||
printf ("%s\n", parseString (exp |> bypass (eof), gen (10)).string)
|
||||
printf ("%s\n", parseString (exp |> bypass (eof), gen (5)).string)
|
||||
|
|
|
|||
19
stdlib/regression/test20.lama
Normal file
19
stdlib/regression/test20.lama
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
fun insert (tree, value) {
|
||||
case tree of
|
||||
Empty -> return Node (value, Empty, Empty)
|
||||
| Node (x, left, right) ->
|
||||
if x > value
|
||||
then return Node (x, insert (left, value), right)
|
||||
else return Node (x, left, insert (right, value))
|
||||
fi
|
||||
esac
|
||||
}
|
||||
|
||||
local i, tree = Empty;
|
||||
|
||||
for i := 0, i <= 10, i := i+1 do
|
||||
printf ("%s\n", tree.string);
|
||||
tree := insert (tree, i)
|
||||
od;
|
||||
|
||||
printf ("%s\n", tree.string)
|
||||
65
stdlib/regression/test21.lama
Normal file
65
stdlib/regression/test21.lama
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
fun collect_ints_acc (v, tail) {
|
||||
local i;
|
||||
|
||||
case v of
|
||||
a@#unboxed -> return Cons (a, tail)
|
||||
| #string -> return tail
|
||||
| _ ->
|
||||
for i := 0, i < v.length, i := i + 1 do
|
||||
tail := collect_ints_acc (v[i], tail)
|
||||
od;
|
||||
return tail
|
||||
esac
|
||||
}
|
||||
|
||||
fun collect_ints (v) {
|
||||
return collect_ints_acc (v, Nil)
|
||||
}
|
||||
|
||||
case 1 of
|
||||
5 -> write (5)
|
||||
| 4 -> write (4)
|
||||
| 3 -> write (3)
|
||||
| 2 -> write (2)
|
||||
| 1 -> write (1)
|
||||
| 0 -> write (0)
|
||||
esac;
|
||||
|
||||
case 1 of
|
||||
a@5 -> write (a)
|
||||
| a@4 -> write (a)
|
||||
| a@3 -> write (a)
|
||||
| a@2 -> write (a)
|
||||
| a@1 -> write (a)
|
||||
| a@0 -> write (a)
|
||||
esac;
|
||||
|
||||
case A (1, 2, 3) of
|
||||
A (1, 3, 5) -> write (0)
|
||||
| A (3, 4, 5) -> write (0)
|
||||
| A (1, 2, 3) -> write (1)
|
||||
| A (6, 7, 8) -> write (0)
|
||||
esac;
|
||||
|
||||
case "abc" of
|
||||
"def" -> write (0)
|
||||
| "ab" -> write (0)
|
||||
| "abc" -> write (1)
|
||||
| "" -> write (0)
|
||||
esac;
|
||||
|
||||
case [1, 2, 3] of
|
||||
[] -> write (0)
|
||||
| [a, b] -> write (0)
|
||||
| [a, b, c] -> write (a); write (b); write (c)
|
||||
| [_, _, _] -> write (0)
|
||||
esac;
|
||||
|
||||
case [1, 2, 3] of
|
||||
[] -> write (0)
|
||||
| [a, b] -> write (0)
|
||||
| [_, _, _] -> write (100)
|
||||
| [a, b, c] -> write (a); write (b); write (c)
|
||||
esac;
|
||||
|
||||
printf ("%s\n", collect_ints ([1, 2, 3, [4, 5, 6, Cons (1, 2, 3)]]).string)
|
||||
10
stdlib/regression/test22.lama
Normal file
10
stdlib/regression/test22.lama
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
local lists = [
|
||||
{},
|
||||
{1, 2, 3, 4},
|
||||
{1 : {}, {2, 3}, {4, {5, 6}}},
|
||||
1 : 2 : 3 : 4 : {}
|
||||
], i;
|
||||
|
||||
for i := 0, i<lists.length, i:=i+1 do
|
||||
printf ("%s\n", lists[i].string)
|
||||
od
|
||||
15
stdlib/regression/test23.lama
Normal file
15
stdlib/regression/test23.lama
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
fun hd (l) {
|
||||
case l of
|
||||
h : _ -> return h
|
||||
esac
|
||||
}
|
||||
|
||||
fun tl (l) {
|
||||
case l of
|
||||
_ : t -> return t
|
||||
esac
|
||||
}
|
||||
|
||||
printf ("%s\n", {1, 2, 3}.hd.string);
|
||||
printf ("%s\n", {1, 2, 3, 4}.tl.string);
|
||||
printf ("%s\n", {1, {2, 3, 4}, 5, 6}.tl.hd.hd.string)
|
||||
3
stdlib/regression/test24.lama
Normal file
3
stdlib/regression/test24.lama
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
printf ("%d\n", infix + (1, 2));
|
||||
printf ("%s\n", (1 : 2).string);
|
||||
printf ("%s\n", (infix : (1, 2)).string)
|
||||
14
stdlib/regression/test25.lama
Normal file
14
stdlib/regression/test25.lama
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
fun f (x, y) {
|
||||
fun () {x+y}
|
||||
}
|
||||
|
||||
printf ("Cloning int: %d\n", clone (5));
|
||||
printf ("Cloning string: %s\n", clone ("abc"));
|
||||
printf ("Cloning array: %s\n", clone ([1, 2, 3, 4, 5]).string);
|
||||
printf ("Cloning sexp: %s\n", clone (A (1, 2, 3, 4, 5)).string);
|
||||
|
||||
{
|
||||
local c = f (5, 6), cc = clone (c);
|
||||
|
||||
printf ("Cloning closure: address %s, %d, %d\n", if cc[0] == c[0] then "ok" else "fail" fi, c[1], c[2])
|
||||
}
|
||||
7
stdlib/regression/test26.lama
Normal file
7
stdlib/regression/test26.lama
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
local i;
|
||||
|
||||
printf ("Number of commands-line arguments: %d\n", sysargs.length);
|
||||
|
||||
for i := 0, i < sysargs.length, i := i + 1 do
|
||||
printf (" arg [%-2d] = %s\n", i, sysargs[i].string)
|
||||
od
|
||||
Loading…
Add table
Add a link
Reference in a new issue