Adding .s
This commit is contained in:
@ -116,20 +116,22 @@ $(GEN):
|
|||||||
POSIX_BOOT = common/boot.fs common/ansi.fs \
|
POSIX_BOOT = common/boot.fs common/ansi.fs \
|
||||||
posix/posix.fs posix/posix_highlevel.fs \
|
posix/posix.fs posix/posix_highlevel.fs \
|
||||||
common/highlevel.fs common/filetools.fs posix/posix_desktop.fs \
|
common/highlevel.fs common/filetools.fs posix/posix_desktop.fs \
|
||||||
common/tasks.fs common/streams.fs common/blocks.fs posix/args.fs
|
common/tasks.fs common/streams.fs common/blocks.fs posix/args.fs \
|
||||||
|
common/utils.fs
|
||||||
$(GEN)/posix_boot.h: common/source_to_string.js $(POSIX_BOOT) | $(GEN)
|
$(GEN)/posix_boot.h: common/source_to_string.js $(POSIX_BOOT) | $(GEN)
|
||||||
echo "ok" | cat $(POSIX_BOOT) - | $< boot >$@
|
echo "ok" | cat $(POSIX_BOOT) - | $< boot >$@
|
||||||
|
|
||||||
WINDOWS_BOOT = common/boot.fs common/ansi.fs \
|
WINDOWS_BOOT = common/boot.fs common/ansi.fs \
|
||||||
windows/windows.fs windows/windows_highlevel.fs common/highlevel.fs \
|
windows/windows.fs windows/windows_highlevel.fs common/highlevel.fs \
|
||||||
common/tasks.fs common/streams.fs common/blocks.fs
|
common/tasks.fs common/streams.fs common/blocks.fs \
|
||||||
|
common/utils.fs
|
||||||
$(GEN)/windows_boot.h: common/source_to_string.js $(WINDOWS_BOOT) | $(GEN)
|
$(GEN)/windows_boot.h: common/source_to_string.js $(WINDOWS_BOOT) | $(GEN)
|
||||||
echo "ok" | cat $(WINDOWS_BOOT) - | $< boot >$@
|
echo "ok" | cat $(WINDOWS_BOOT) - | $< boot >$@
|
||||||
|
|
||||||
ARDUINO_BOOT = common/boot.fs arduino/arduino.fs \
|
ARDUINO_BOOT = common/boot.fs arduino/arduino.fs \
|
||||||
posix/posix_highlevel.fs common/highlevel.fs common/filetools.fs \
|
posix/posix_highlevel.fs common/highlevel.fs common/filetools.fs \
|
||||||
common/tasks.fs common/streams.fs arduino/arduino_server.fs \
|
common/tasks.fs common/streams.fs arduino/arduino_server.fs \
|
||||||
arduino/esp_camera.fs common/blocks.fs \
|
arduino/esp_camera.fs common/blocks.fs common/utils.fs \
|
||||||
arduino/autoboot.fs
|
arduino/autoboot.fs
|
||||||
$(GEN)/arduino_boot.h: common/source_to_string.js $(ARDUINO_BOOT) | $(GEN)
|
$(GEN)/arduino_boot.h: common/source_to_string.js $(ARDUINO_BOOT) | $(GEN)
|
||||||
echo "ok" | cat $(ARDUINO_BOOT) - | $< boot >$@
|
echo "ok" | cat $(ARDUINO_BOOT) - | $< boot >$@
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
include common/testing.fs
|
include common/testing.fs
|
||||||
|
include common/utils.fs
|
||||||
include common/base_tests.fs
|
include common/base_tests.fs
|
||||||
|
include common/utils_tests.fs
|
||||||
run-tests
|
run-tests
|
||||||
|
|||||||
@ -32,7 +32,7 @@ variable confirm-old-type
|
|||||||
: }confirm confirm-old-type @ is type ;
|
: }confirm confirm-old-type @ is type ;
|
||||||
: expect-reset 0 expect-used ! 0 result-used ! ;
|
: expect-reset 0 expect-used ! 0 result-used ! ;
|
||||||
: expect-finish expected resulted str= if exit then }confirm
|
: expect-finish expected resulted str= if exit then }confirm
|
||||||
." Expected:" cr expected type cr ." Resulted:" cr resulted type cr 1 throw ;
|
cr ." Expected:" cr expected type cr ." Resulted:" cr resulted type cr 1 throw ;
|
||||||
|
|
||||||
( Testing Framework )
|
( Testing Framework )
|
||||||
( run-tests runs all words starting with "test-", use assert to assert things. )
|
( run-tests runs all words starting with "test-", use assert to assert things. )
|
||||||
@ -42,7 +42,7 @@ variable tests-found variable tests-run variable tests-passed
|
|||||||
last @ begin dup while dup test? if 2dup >r >r swap execute r> r> then >link repeat 2drop ;
|
last @ begin dup while dup test? if 2dup >r >r swap execute r> r> then >link repeat 2drop ;
|
||||||
: reset-test-counters 0 tests-found ! 0 tests-run ! 0 tests-passed ! ;
|
: reset-test-counters 0 tests-found ! 0 tests-run ! 0 tests-passed ! ;
|
||||||
: count-test ( xt -- ) drop 1 tests-found +! ;
|
: count-test ( xt -- ) drop 1 tests-found +! ;
|
||||||
: check-fresh depth if ." DEPTH LEAK! " depth . 1 throw then ;
|
: check-fresh depth if }confirm ." DEPTH LEAK! " depth . 1 throw then ;
|
||||||
: wrap-test ( xt -- ) expect-reset >r check-fresh r> execute check-fresh expect-finish ;
|
: wrap-test ( xt -- ) expect-reset >r check-fresh r> execute check-fresh expect-finish ;
|
||||||
: red 1 fg ; : green 2 fg ; : hr 40 for [char] - emit next cr ;
|
: red 1 fg ; : green 2 fg ; : hr 40 for [char] - emit next cr ;
|
||||||
: replace-line 13 emit clear-to-eol ;
|
: replace-line 13 emit clear-to-eol ;
|
||||||
|
|||||||
5
ueforth/common/utils.fs
Normal file
5
ueforth/common/utils.fs
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
( Variable useful but non-critical words )
|
||||||
|
|
||||||
|
: .s ." <" depth <# #s #> type ." > "
|
||||||
|
depth 0 max for aft sp@ r@ cells - @ . then next cr ;
|
||||||
|
|
||||||
15
ueforth/common/utils_tests.fs
Normal file
15
ueforth/common/utils_tests.fs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
( Tests of utils.fs )
|
||||||
|
e: test-.s0
|
||||||
|
.s
|
||||||
|
out: <0>
|
||||||
|
;e
|
||||||
|
|
||||||
|
e: test-.s
|
||||||
|
1 2 3 .s
|
||||||
|
out: <3> 1 2 3
|
||||||
|
128 .s
|
||||||
|
out: <4> 1 2 3 128
|
||||||
|
2drop 2drop
|
||||||
|
.s
|
||||||
|
out: <0>
|
||||||
|
;e
|
||||||
Reference in New Issue
Block a user