From: Ian Jackson Date: Sun, 4 Oct 2020 23:55:48 +0000 (+0100) Subject: make chedk X-Git-Tag: otter-0.2.0~746 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=e1df1ff2e01788433c58ffa1ebf974e6ec29dc9f;p=otter.git make chedk Signed-off-by: Ian Jackson --- diff --git a/.gitignore b/.gitignore index 1fb4a99e..41bbff84 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ templates/script.js +templates/bigfloat-tests.js templates/LICENCE templates/AGPLv3 templates/CC-BY-SA-3.0 diff --git a/Makefile b/Makefile index c16606f6..2e445ad7 100644 --- a/Makefile +++ b/Makefile @@ -65,6 +65,9 @@ cargo-debug cargo-release:: cargo-%: $(CARGO_TARGET_DIR)/%/server .PHONY: $(CARGO_TARGET_DIR)/debug/server .PHONY: $(CARGO_TARGET_DIR)/release/server +check: cargo-check js-check + @echo 'All tests passed.' + extra-debug: extra-release: bundled-sources @@ -74,14 +77,24 @@ $(CARGO_TARGET_DIR)/bundled-sources: $(BUNDLE_SOURCES) @echo Bundled sources. .PHONY: bundle-sources $(CARGO_TARGET_DIR)/bundled-sources +cargo-check: + $(CARGO) test + $(CARGO_TARGET_DIR)/debug/server: $(CARGO) build $(CARGO_TARGET_DIR)/release/server: $(CARGO) build --release -templates/script.js: tsc-wrap tsconfig.json $(TS_SRC_FILES) - ./tsc-wrap $@ tsconfig.json $(TS_SRC_FILES) +templates/%.js: tsc-wrap tsconfig.json + ./tsc-wrap $@ tsconfig.json $(filter %.ts,$^) + +templates/script.js: $(TS_SRC_FILES) +templates/bigfloat-tests.js: templates/bigfloat.ts templates/bigfloat-tests.ts + +js-check: templates/bigfloat-tests.js + nodejs <$< + @echo 'nodejs check $< ok' DEPLOY_ARCH=x86_64-unknown-linux-musl DEPLOY_RELEASE=debug diff --git a/templates/bigfloat-tests.ts b/templates/bigfloat-tests.ts index bc87f45a..40652a27 100644 --- a/templates/bigfloat-tests.ts +++ b/templates/bigfloat-tests.ts @@ -3,13 +3,15 @@ // SPDX-License-Identifier: AGPL-3.0-or-later // There is NO WARRANTY. -function assert_eq(a,b) { if (a != b) throw('unequal ' + a + ' ' + b); } +function assert_eq(a: string, b: string) { + if (a != b) throw('unequal ' + a + ' ' + b); +} -x = "!0000 ffff_ffff_fff0"; -y = "!0000 0000_0000_0040"; -i = Bigfloats.iter_upto(x, y, 4); +let x = "!0000 ffff_ffff_fff0" as any; +let y = "!0000 0000_0000_0040" as any; +let 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(), "+0000x 0000_0000_0030"); +assert_eq(i(), "+0000 0000_0000_0030");