ref: 3d6626df984b440baa1446f9b6dbf96a37b010eb
parent: b219309416b7f89e2ba6114bdf8f72f91e9f94b9
author: Ori Bernstein <[email protected]>
date: Mon Oct 6 09:31:07 EDT 2014
Delete test.myr It's not used.
--- a/libstd/Makefile
+++ b/libstd/Makefile
@@ -61,7 +61,7 @@
include ../config.mk
-all: lib$(MYRLIB).a $(MYRBIN) test
+all: lib$(MYRLIB).a $(MYRBIN)
%.myr: %+$(SYS).myr
cp $< $@
@@ -69,10 +69,6 @@
%.s: %+$(SYS)-x64.s
cp $< $@
-test: libstd.a test.myr ../6/6m
- ../myrbuild/myrbuild -C../6/6m -M../muse/muse -b test -I. -r../rt/_myrrt.o test.myr
-
-
lib$(MYRLIB).a: $(MYRSRC) $(ASMSRC) ../6/6m
../myrbuild/myrbuild -C../6/6m -M../muse/muse -l $(MYRLIB) $(MYRSRC) $(ASMSRC)
@@ -80,8 +76,8 @@
USE=$(MYRSRC:.myr=.use) $(MYRLIB)
.PHONY: clean
clean:
- rm -f $(OBJ) test.o
- rm -f $(USE) test.use
+ rm -f $(OBJ)
+ rm -f $(USE)
rm -f lib$(MYRLIB).a
install: all
--- a/libstd/test.myr
+++ /dev/null
@@ -1,130 +1,0 @@
-use std
-
-const ntstr = {s
- var n
-
- n = 0
- while s[n] != 0 && n < s.len
- n++
- ;;
- -> s[:n]
-}
-
-const main = {args : byte[:][:]
- var x : byte#[1024]
- var sz
- var i
- var ctx
- var o
- var a
- var buf
-
- std.put("The time is %l seconds past the epoch\n", std.now()/1_000_000);
- std.uname(&buf)
- std.put("And you are running on:\n")
- std.put("\tsystem:\t\"%s\"\n", ntstr(buf.system[:]))
- std.put("\tnode:\t\"%s\"\n", ntstr(buf.node[:]))
- std.put("\trelease:\t\"%s\"\n", ntstr(buf.release[:]))
- std.put("\tmachine:\t\"%s\"\n", ntstr(buf.machine[:]))
- ctx = std.optinit("asdf:g?h", args)
- std.put("arglen = %i\n", ctx.args.len)
- while !std.optdone(ctx)
- (o, a) = std.optnext(ctx)
- if o == 'h'
- usage()
- ;;
- std.put("option %c, arg = %s\n", o, a)
- ;;
-
- std.put("env.len = %i\n", std._environment.len)
- for i = 0; i < std._environment.len; i++
- std.put("env[%i] = %s\n", i, std._environment[i])
- ;;
- std.put("args.len = %i\n", args.len)
- for i = 0; i < args.len; i++
- std.put("args[%i] = %s\n", i, args[i])
- ;;
-
- for i = 0; i < ctx.args.len; i++
- std.put("arg %s\n", ctx.args[i])
- ;;
- printenv("SHELL")
-
-
- /* try the byte allocator for large variety of sizes. */
- for sz = 1; sz < 65536; sz *= 2
- for i = 0; i < 1024; i++
- x[i] = std.bytealloc(sz)
- ;;
- for i = 0; i < 1024; i++
- std.bytefree(x[i], sz)
- ;;
- ;;
-
- /* make sure the generic allocator works */
- for i = 0; i < 1024; i++
- x[i] = std.alloc()
- ;;
- for i = 0; i < 1024; i++
- std.free(x[i])
- ;;
- std.write(1, "Hello, 世界\n")
- chartypes()
- testrng()
- std.put("format output %i %i %s %s\n", 123, 321, "asdf", "מִלָּה")
- std.put("format with no args\n")
-}
-
-const chartypes = {
- var s
- var c
- var buf : byte[32]
-
- s = " 1世界 äa\n"
- while s.len != 0
- (c, s) = std.striter(s)
- if std.isspace(c)
- std.write(1, "Space\n")
- elif std.isalpha(c)
- std.write(1, "Alpha\n")
- elif std.isnum(c)
- std.write(1, "Num\n")
- else
- std.write(1, "Dunno\n")
- ;;
- if !std.encode(buf[:std.charlen(c)], c)
- std.write(1, "couldn't encode\n")
- ;;
- std.write(1, buf[:std.charlen(c)])
- std.write(1, "\n")
- ;;
- if !std.encode(buf[0:3], -1)
- std.write(1, "couldn't encode\n")
- ;;
-}
-
-const testrng = {
- var r
- var i
-
- r = std.mksrng(10)
- for i = 0; i < 300; i++
- std.put("r[%i] = %l\n", i, std.rand(r, 5, 10) castto(int64))
- ;;
- std.put("\n");
-}
-
-const usage = {
- std.put("Pokes a bit at the standard library.\n")
- std.put("Option string is asdf:g?h\n")
- std.exit(0)
-}
-
-const printenv = {name
- match std.getenv(name)
- | `std.Some env:
- std.put("Value of %s is %s\n", name, env)
- | `std.None:
- std.put("No env var %s is set\n", name)
- ;;
-}