Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
templates/script.js
templates/bigfloat-tests.js
+templates/bigfloat-tests-auto.ts
templates/LICENCE
templates/AGPLv3
templates/CC-BY-SA-3.0
./tsc-wrap $@ tsconfig.json $(filter %.ts,$^)
templates/script.js: $(TS_SRC_FILES)
-templates/bigfloat-tests.js: templates/bigfloat.ts templates/bigfloat-tests.ts
+templates/bigfloat-tests.js: templates/bigfloat.ts \
+ templates/bigfloat-tests.ts templates/bigfloat-tests-auto.ts
+
+templates/bigfloat-tests-auto.ts: extract-bf-tests src/bigfloat.rs
+ ./$^ >$@.tmp && mv -f $@.tmp $@
js-check: templates/bigfloat-tests.js
nodejs <$<
--- /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";
+}
+
+while (<>) {
+ next unless m/^mod test/..0;
+ my $l = $_;
+ $l =~ s{bf\((\"[^"]+\")\)}{ chk_repr($1) }ge;
+}
#[cfg(test)]
mod test {
+ // everything from here on is seded by the js test extractor!
use super::*;
fn bf(s: &str) -> Bigfloat {