+++ /dev/null
-#!/usr/bin/perl -w
-use strict;
-
-sub chk_repr ($) {
- my ($p) = @_;
- print "assert_eq($p, Bigfloats.pack(Bigfloats.unpack($p as any)));\n";
-}
-
-my $sre = qr{\"[^"]+\"};
-
-print <<END;
-// autogenerated from $0 @ARGV
-let mk : any;
-END
-
-while (<>) {
- next unless m/^mod test/..0;
- my $l = $_;
- $l =~ s{bf\(($sre)\)}{ chk_repr($1) }ge;
-
- if (m{^ +fn addition}..m{^ +\#\[test\]}) {
- if (m{^ +mk\(($sre)\)}) {
- print "mk = $1;\n";
- } elsif (m{^ +\.chk\((\w+),\s*($sre)\)\s*$}) {
- print "mk = Bigfloats.add(mk, $1); assert_eq(mk, $2);\n";
- }
- }
-}
+++ /dev/null
-// -*- JavaScript -*-
-// Copyright 2020 Ian Jackson
-// SPDX-License-Identifier: AGPL-3.0-or-later
-// There is NO WARRANTY.
-
-function assert_eq(a: string, b: string) {
- if (a == b) return;
- console.log(['unequal', a, b]);
- throw('unequal');
-}
-
-let x : any;
-let y : any
-let i : any
-
-x = "!0000 ffff_ffff_fff0" as any;
-y = "!0000 0000_0000_0040" as any;
-i = Bigfloats.iter_upto(x, y, 4);
-
-assert_eq(i(), "+0000 0000_0000_0000");
-assert_eq(i(), "+0000 0000_0000_0010");
-assert_eq(i(), "+0000 0000_0000_0020");
-assert_eq(i(), "+0000 0000_0000_0030");
-
-x = "!0000 ffff_ffff_fffe" as any;
-y = "!0000 0000_0000_0001" as any;
-i = Bigfloats.iter_upto(x, y, 4);
-
-assert_eq(i(), "!0000 ffff_ffff_ffff 3333_3333_3333");
-assert_eq(i(), "!0000 ffff_ffff_ffff 6666_6666_6666");
-assert_eq(i(), "!0000 ffff_ffff_ffff 9999_9999_9999");
-assert_eq(i(), "!0000 ffff_ffff_ffff cccc_cccc_cccc");