summaryrefslogtreecommitdiff
path: root/tests/arr
diff options
context:
space:
mode:
Diffstat (limited to 'tests/arr')
-rw-r--r--tests/arr/arr.toc70
-rw-r--r--tests/arr/expected200
-rwxr-xr-xtests/arr/test.sh3
3 files changed, 0 insertions, 273 deletions
diff --git a/tests/arr/arr.toc b/tests/arr/arr.toc
deleted file mode 100644
index eee514a..0000000
--- a/tests/arr/arr.toc
+++ /dev/null
@@ -1,70 +0,0 @@
-puti ::= fn(x: int) {
-//tcc's giving me "incompatible types for redefinition of 'printf'" for some reason (even though the declarations have the exact same type)
- #C("#ifndef __TINYC__
-extern int printf(const char *fmt, ...);
-#endif
-");
- #C("printf(\"%ld\\n\", (long)x);");
-};
-putf ::= fn(x: float) {
- #C("#ifndef __TINYC__
-extern int printf(const char *fmt, ...);
-#endif
-");
- #C("printf(\"%f\\n\", (double)x);");
-};
-
-// it would be nice if Arr.data.len == Arr.len (: but this will require some C code...
-Arr ::= fn (t :: Type) Type {
- struct {
- data : []t;
- len, cap : int;
- }
-};
-
-arr_add ::= fn(t :: Type, a : &Arr(t), x : t) {
- if a.len >= a.cap {
- a.cap = a.cap * 2 + 2;
- new_data := new(t, a.cap);
- for i := 0..a.len-1 {
- new_data[i] = a.data[i];
- }
- a.data = new_data;
- }
- a.data[a.len] = x;
- a.len += 1;
-};
-
-square ::= fn(t :: Type, x : t) t {
- a : Arr(t);
- for i := 1,2..2*x-1 {
- arr_add(t, &a, i);
- };
- sum := 0 as t;
- for i := 0..a.len-1 {
- sum += a.data[i];
- };
- sum
-};
-
-
-ArrInt ::= Arr(int);
-
-inc ::= fn(t :: Type, x : t) t {
- x + 1
-};
-
-main ::= fn() {
- arr : ArrInt;
- farr : Arr(float);
- for i := 1..100 {
- arr_add(int, &arr, inc(int, square(int, i)));
- arr_add(float, &farr, inc(float, square(float, i as float)));
- }
- for i := 0..arr.len - 1 {
- puti(arr.data[i]);
- }
- for i := 0..farr.len - 1 {
- putf(farr.data[i]);
- }
-};
diff --git a/tests/arr/expected b/tests/arr/expected
deleted file mode 100644
index c0a3e45..0000000
--- a/tests/arr/expected
+++ /dev/null
@@ -1,200 +0,0 @@
-2
-5
-10
-17
-26
-37
-50
-65
-82
-101
-122
-145
-170
-197
-226
-257
-290
-325
-362
-401
-442
-485
-530
-577
-626
-677
-730
-785
-842
-901
-962
-1025
-1090
-1157
-1226
-1297
-1370
-1445
-1522
-1601
-1682
-1765
-1850
-1937
-2026
-2117
-2210
-2305
-2402
-2501
-2602
-2705
-2810
-2917
-3026
-3137
-3250
-3365
-3482
-3601
-3722
-3845
-3970
-4097
-4226
-4357
-4490
-4625
-4762
-4901
-5042
-5185
-5330
-5477
-5626
-5777
-5930
-6085
-6242
-6401
-6562
-6725
-6890
-7057
-7226
-7397
-7570
-7745
-7922
-8101
-8282
-8465
-8650
-8837
-9026
-9217
-9410
-9605
-9802
-10001
-2.000000
-5.000000
-10.000000
-17.000000
-26.000000
-37.000000
-50.000000
-65.000000
-82.000000
-101.000000
-122.000000
-145.000000
-170.000000
-197.000000
-226.000000
-257.000000
-290.000000
-325.000000
-362.000000
-401.000000
-442.000000
-485.000000
-530.000000
-577.000000
-626.000000
-677.000000
-730.000000
-785.000000
-842.000000
-901.000000
-962.000000
-1025.000000
-1090.000000
-1157.000000
-1226.000000
-1297.000000
-1370.000000
-1445.000000
-1522.000000
-1601.000000
-1682.000000
-1765.000000
-1850.000000
-1937.000000
-2026.000000
-2117.000000
-2210.000000
-2305.000000
-2402.000000
-2501.000000
-2602.000000
-2705.000000
-2810.000000
-2917.000000
-3026.000000
-3137.000000
-3250.000000
-3365.000000
-3482.000000
-3601.000000
-3722.000000
-3845.000000
-3970.000000
-4097.000000
-4226.000000
-4357.000000
-4490.000000
-4625.000000
-4762.000000
-4901.000000
-5042.000000
-5185.000000
-5330.000000
-5477.000000
-5626.000000
-5777.000000
-5930.000000
-6085.000000
-6242.000000
-6401.000000
-6562.000000
-6725.000000
-6890.000000
-7057.000000
-7226.000000
-7397.000000
-7570.000000
-7745.000000
-7922.000000
-8101.000000
-8282.000000
-8465.000000
-8650.000000
-8837.000000
-9026.000000
-9217.000000
-9410.000000
-9605.000000
-9802.000000
-10001.000000
diff --git a/tests/arr/test.sh b/tests/arr/test.sh
deleted file mode 100755
index d50fb1a..0000000
--- a/tests/arr/test.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-./arr.bin > got || exit 1
-diff got expected || exit 1