Skip to content

Commit 508c197

Browse files
committed
OK lets test the libraries now
1 parent 28286ca commit 508c197

43 files changed

Lines changed: 2649 additions & 2624 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

BOOTSTRAP/cli.c

Lines changed: 2585 additions & 2567 deletions
Large diffs are not rendered by default.

Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ dev: install-production
77
./a.out
88

99
build: compile-production
10-
time ./production --v23 --c -o deploy1.c SRC/index.lsts
10+
time ./production --v2 --c -o deploy1.c SRC/index.lsts
1111
$(CC) $(CFLAGS) deploy1.c -o deploy1
12-
time ./deploy1 --v23 --c -o deploy2.c SRC/index.lsts
12+
time ./deploy1 --v2 --c -o deploy2.c SRC/index.lsts
1313
diff deploy1.c deploy2.c
1414
mv deploy1.c BOOTSTRAP/cli.c
1515
rm -f deploy1 deploy1.c deploy2.c
@@ -19,7 +19,7 @@ deploy: build smoke-test
1919
deploy-lite: build smoke-test-lite
2020

2121
valgrind: install-bootstrap
22-
valgrind --tool=callgrind lm --v23 SRC/index.lsts
22+
valgrind --tool=callgrind lm --v2 SRC/index.lsts
2323

2424
valgrind-view:
2525
callgrind_annotate callgrind.out.18778
@@ -35,7 +35,7 @@ gprof-view-call-graph:
3535
gprof -q bootstrap.exe gmon.out
3636

3737
profile: install-bootstrap
38-
perf record lm --v23 SRC/index.lsts
38+
perf record lm --v2 SRC/index.lsts
3939
./report.sh
4040

4141
compile-bootstrap:
@@ -44,7 +44,7 @@ compile-bootstrap:
4444

4545
compile-production: compile-bootstrap
4646
rm -f production
47-
./bootstrap.exe --v23 --c -o production.c SRC/index.lsts
47+
./bootstrap.exe --v2 --c -o production.c SRC/index.lsts
4848
$(CC) $(CFLAGS) -o production production.c
4949
rm -f production.c
5050

lib/std/i64.lsts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ let to-string(i: I64): CString = (
4040
clone-rope(sign + r);
4141
);
4242

43+
let .into(i: I64, tt: Type<CString>): CString = to-string(i);
44+
4345
let to-i64(s: CString): I64 = (
4446
let negative = false;
4547
if head-string(s)==45 {

lib/std/smart-string.lsts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ let $"[:]"(x: String, low: I64, hi: I64): String = (
9999
);
100100

101101
let tail-string(x: String): String = x[ 1_i64 : x.length as I64 ];
102+
let tail(x: String): String = x[ 1_i64 : x.length as I64 ];
102103

103104
let $"[]"(x: String, low: I64): U8 = (
104105
if low < 0 then low = (x.length as I64) + low;
@@ -113,6 +114,7 @@ let $"[]"(x: String, low: U64): U8 = (
113114
);
114115

115116
let head-string(x: String): U8 = x[0_u64];
117+
let head(x: String): U8 = x[0_u64];
116118

117119
let .has-suffix(base: String, sfx: String): U64 = (
118120
base.length >= sfx.length &&

lib2/core/string.lsts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,3 +194,6 @@ let .remove-prefix(base: String, pfx: String): String = (
194194
then base[ pfx.length as I64 : minimum-I64 ]
195195
else base
196196
);
197+
198+
let tail(x: String): String = x[ 1_i64 : x.length as I64 ];
199+
let head(x: String): U8 = x[0];

tests/promises/hashtable/bound-bind.lsts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import lib/std/minimal.lsts;
33

44
assert( mk-hashtable(type(U8), type(U8), 0).bind(8,9).length == 1 );
55
assert( safe-alloc-block-count == 0 );
6-
assert( safe-alloc-block-count-monotonic == 1 );
6+
if not(config-v23) then assert( safe-alloc-block-count-monotonic == 1 );
77
safe-alloc-block-count-monotonic = 0;
88

99
# it isn't possible to just gently push the hashtable over the resize threshold
@@ -12,15 +12,15 @@ safe-alloc-block-count-monotonic = 0;
1212
# additionally, that threshold could be non-linear etc. so it is hard to test directly
1313
assert( mk-hashtable(type(U8), type(U8), 100).bind(8,9).length == 1 );
1414
assert( safe-alloc-block-count == 0 );
15-
assert( safe-alloc-block-count-monotonic == 1 );
15+
if not(config-v23) then assert( safe-alloc-block-count-monotonic == 1 );
1616
safe-alloc-block-count-monotonic = 0;
1717

1818
assert( mk-hashtable(type(U8), type(U8), 100).bind(8,9).bind(8,10).length == 1 );
1919
assert( safe-alloc-block-count == 0 );
20-
assert( safe-alloc-block-count-monotonic == 1 );
20+
if not(config-v23) then assert( safe-alloc-block-count-monotonic == 1 );
2121
safe-alloc-block-count-monotonic = 0;
2222

2323
assert( mk-hashtable(type(U8), type(U8), 100).bind(8,9).bind(9,10).length == 2 );
2424
assert( safe-alloc-block-count == 0 );
25-
assert( safe-alloc-block-count-monotonic == 1 );
25+
if not(config-v23) then assert( safe-alloc-block-count-monotonic == 1 );
2626
safe-alloc-block-count-monotonic = 0;

tests/promises/hashtable/bound-constructor.lsts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ safe-alloc-block-count-monotonic = 0;
1313

1414
assert( mk-hashtable(type(U8), type(U8), 123).length == 0 );
1515
assert( safe-alloc-block-count == 0 );
16-
assert( safe-alloc-block-count-monotonic == 1 );
16+
if not(config-v23) then assert( safe-alloc-block-count-monotonic == 1 );
1717
safe-alloc-block-count-monotonic = 0;
1818

1919
assert( (mk-hashtable() : Hashtable<U8,U8>).length == 0 );
@@ -28,5 +28,5 @@ safe-alloc-block-count-monotonic = 0;
2828

2929
assert( (mk-hashtable(123) : Hashtable<U8,U8>).length == 0 );
3030
assert( safe-alloc-block-count == 0 );
31-
assert( safe-alloc-block-count-monotonic == 1 );
31+
if not(config-v23) then assert( safe-alloc-block-count-monotonic == 1 );
3232
safe-alloc-block-count-monotonic = 0;

tests/promises/hashtable/bound-has.lsts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ import lib/std/minimal.lsts;
33

44
assert( mk-hashtable(type(U8), type(U8), 0).bind(8,9).has(8) );
55
assert( safe-alloc-block-count == 0 );
6-
assert( safe-alloc-block-count-monotonic == 1 );
6+
if not(config-v23) then assert( safe-alloc-block-count-monotonic == 1 );
77
safe-alloc-block-count-monotonic = 0;
88

99
assert( not(mk-hashtable(type(U8), type(U8), 0).bind(8,9).has(9)) );
1010
assert( safe-alloc-block-count == 0 );
11-
assert( safe-alloc-block-count-monotonic == 1 );
11+
if not(config-v23) then assert( safe-alloc-block-count-monotonic == 1 );
1212
safe-alloc-block-count-monotonic = 0;

tests/promises/hashtable/bound-index.lsts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ import lib/std/minimal.lsts;
33

44
assert( mk-hashtable(type(U8), type(U8), 0).bind(8,9)[8] == Some(9) );
55
assert( safe-alloc-block-count == 0 );
6-
assert( safe-alloc-block-count-monotonic == 1 );
6+
if not(config-v23) then assert( safe-alloc-block-count-monotonic == 1 );
77
safe-alloc-block-count-monotonic = 0;
88

99
assert( mk-hashtable(type(U8), type(U8), 0).bind(8,9)[9] == (None : U8?) );
1010
assert( safe-alloc-block-count == 0 );
11-
assert( safe-alloc-block-count-monotonic == 1 );
11+
if not(config-v23) then assert( safe-alloc-block-count-monotonic == 1 );
1212
safe-alloc-block-count-monotonic = 0;

tests/promises/hashtable/bound-length.lsts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ safe-alloc-block-count-monotonic = 0;
88

99
assert( mk-hashtable(type(U8), type(U8), 123).length == 0 );
1010
assert( safe-alloc-block-count == 0 );
11-
assert( safe-alloc-block-count-monotonic == 1 );
11+
if not(config-v23) then assert( safe-alloc-block-count-monotonic == 1 );
1212
safe-alloc-block-count-monotonic = 0;

0 commit comments

Comments
 (0)