summaryrefslogtreecommitdiff
path: root/lib/std
diff options
context:
space:
mode:
Diffstat (limited to 'lib/std')
-rw-r--r--lib/std/dial+plan9.myr1
-rw-r--r--lib/std/dial+posixy.myr1
-rw-r--r--lib/std/dialparse+posixy.myr17
-rw-r--r--lib/std/env+plan9.myr3
-rw-r--r--lib/std/env+posixy.myr9
-rw-r--r--lib/std/fmt.myr2
-rw-r--r--lib/std/hashfuncs.myr9
-rw-r--r--lib/std/hassuffix.myr3
-rw-r--r--lib/std/ipparse.myr5
-rw-r--r--lib/std/listen+posixy.myr3
-rw-r--r--lib/std/optparse.myr9
-rw-r--r--lib/std/pathjoin.myr23
-rw-r--r--lib/std/sleq.myr83
-rw-r--r--lib/std/test/bigint.myr4
-rw-r--r--lib/std/test/chomp.myr2
-rw-r--r--lib/std/test/dirname.myr2
-rw-r--r--lib/std/test/fmt.myr2
-rw-r--r--lib/std/test/ipparse.myr2
-rw-r--r--lib/std/test/netaddr.myr2
-rw-r--r--lib/std/test/pathjoin.myr4
-rw-r--r--lib/std/test/slcp.myr6
-rw-r--r--lib/std/test/sleq.myr10
-rw-r--r--lib/std/test/sort.myr6
-rw-r--r--lib/std/test/strbuf.myr26
-rw-r--r--lib/std/test/strsplit.myr2
-rw-r--r--lib/std/varargs.myr1
26 files changed, 156 insertions, 81 deletions
diff --git a/lib/std/dial+plan9.myr b/lib/std/dial+plan9.myr
index cfdd2ba..0fa91bd 100644
--- a/lib/std/dial+plan9.myr
+++ b/lib/std/dial+plan9.myr
@@ -6,7 +6,6 @@ use "fmt"
use "option"
use "pathjoin"
use "result"
-use "sleq"
use "strfind"
use "strstrip"
use "syswrap"
diff --git a/lib/std/dial+posixy.myr b/lib/std/dial+posixy.myr
index 386dac5..286ab43 100644
--- a/lib/std/dial+posixy.myr
+++ b/lib/std/dial+posixy.myr
@@ -8,7 +8,6 @@ use "endian"
use "option"
use "result"
use "slcp"
-use "sleq"
use "strfind"
use "striter"
use "syswrap"
diff --git a/lib/std/dialparse+posixy.myr b/lib/std/dialparse+posixy.myr
index 76fc3ed..9dd36bd 100644
--- a/lib/std/dialparse+posixy.myr
+++ b/lib/std/dialparse+posixy.myr
@@ -2,14 +2,15 @@ use "alloc"
use "chartype"
use "hasprefix"
use "intparse"
+use "ipparse"
+use "option"
+use "resolve"
+use "result"
use "slcp"
use "sleq"
use "strfind"
use "striter"
-use "option"
-use "result"
-use "ipparse"
-use "resolve"
+use "traits"
pkg std =
pkglocal const parseport : (port : byte[:] -> option(uint16))
@@ -22,13 +23,13 @@ const parseport = {port
| `Some n: -> `Some n
| `None:
/* a small number of hardcoded ports */
- if sleq(port, "http")
+ if eq(port, "http")
-> `Some 80
- elif sleq(port, "https")
+ elif eq(port, "https")
-> `Some 443
- elif sleq(port, "ircd")
+ elif eq(port, "ircd")
-> `Some 6667
- elif sleq(port, "dns")
+ elif eq(port, "dns")
-> `Some 53
;;
;;
diff --git a/lib/std/env+plan9.myr b/lib/std/env+plan9.myr
index 23d3714..4edb245 100644
--- a/lib/std/env+plan9.myr
+++ b/lib/std/env+plan9.myr
@@ -9,7 +9,6 @@ use "option"
use "result"
use "slcp"
use "sldup"
-use "sleq"
use "slpush"
use "slurp"
use "blat"
@@ -27,7 +26,7 @@ var envval : byte[:][:]
const envfind = {key
lock(envlck)
for var i = 0; i < envkey.len; i++
- if std.sleq(envkey[i], key)
+ if std.eq(envkey[i], key)
unlock(envlck)
-> `Some envval[i]
;;
diff --git a/lib/std/env+posixy.myr b/lib/std/env+posixy.myr
index 795089a..7ee9e43 100644
--- a/lib/std/env+posixy.myr
+++ b/lib/std/env+posixy.myr
@@ -5,13 +5,14 @@ use "cstrconv"
use "die"
use "extremum"
use "fmt"
+use "sleq"
use "memops"
use "option"
-use "sldup"
use "slcp"
-use "sleq"
+use "sldup"
use "slpush"
use "threadhooks"
+use "traits"
pkg std =
const getenv : (name : byte[:] -> option(byte[:]))
@@ -32,7 +33,7 @@ const getenv = {name
if envp != Zenvp
env = cstrconvp(envp)
n = min(name.len, env.len)
- if sleq(name, env[:n]) && sleq(env[n:n+1], "=")
+ if eq(name, env[:n]) && eq(env[n:n+1], "=")
-> `Some env[n+1:]
;;
;;
@@ -61,7 +62,7 @@ const setenv = {name, val
if envp != Zenvp
env = cstrconvp(envp)
n = min(name.len, env.len - 1)
- if sleq(name, env[:n]) && env[n] == ('=' : byte)
+ if eq(name, env[:n]) && env[n] == ('=' : byte)
found = true
break
;;
diff --git a/lib/std/fmt.myr b/lib/std/fmt.myr
index 663f0f9..f1e6736 100644
--- a/lib/std/fmt.myr
+++ b/lib/std/fmt.myr
@@ -13,8 +13,8 @@ use "memops"
use "option"
use "result"
use "sldup"
-use "sleq"
use "slpush"
+use "sleq"
use "strbuf"
use "strfind"
use "striter"
diff --git a/lib/std/hashfuncs.myr b/lib/std/hashfuncs.myr
index a7d61c4..013bfde 100644
--- a/lib/std/hashfuncs.myr
+++ b/lib/std/hashfuncs.myr
@@ -2,21 +2,16 @@ use "alloc"
use "chartype"
use "die"
use "getint"
-use "sleq"
use "slpush"
use "traits"
use "types"
use "utf"
+use "memops"
+use "sleq"
pkg std =
const siphash24 : (data : byte[:], seed : byte[16] -> uint64)
- impl equatable @a[:] =
- eq = {a, b
- -> sleq(a, b)
- }
- ;;
-
impl hashable @a[:] =
hash = {a
-> siphash24((a : byte#)[:a.len * sizeof(@a)], Seed)
diff --git a/lib/std/hassuffix.myr b/lib/std/hassuffix.myr
index 4802da0..bfcbe74 100644
--- a/lib/std/hassuffix.myr
+++ b/lib/std/hassuffix.myr
@@ -1,3 +1,4 @@
+use "traits"
use "sleq"
pkg std =
@@ -9,7 +10,7 @@ const hassuffix = {s, suff
if suff.len <= s.len
tail = s[s.len - suff.len:]
- -> sleq(tail, suff)
+ -> eq(tail, suff)
;;
-> false
}
diff --git a/lib/std/ipparse.myr b/lib/std/ipparse.myr
index 16da94e..1147888 100644
--- a/lib/std/ipparse.myr
+++ b/lib/std/ipparse.myr
@@ -1,13 +1,14 @@
use "chartype"
use "die"
use "fmt"
+use "sleq"
use "intparse"
use "option"
use "slcp"
-use "sleq"
use "slfill"
use "strfind"
use "striter"
+use "traits"
use "types"
/* FIXME: needed for decls which should be pulled in as hidden */
@@ -60,7 +61,7 @@ const ip6parse = {ip
ok = true
expand = false
split = 0
- if ip.len > 2 && std.sleq(ip[:2], "::")
+ if ip.len > 2 && eq(ip[:2], "::")
expand = true
split = 0
;;
diff --git a/lib/std/listen+posixy.myr b/lib/std/listen+posixy.myr
index 3cb0322..e8018e9 100644
--- a/lib/std/listen+posixy.myr
+++ b/lib/std/listen+posixy.myr
@@ -14,6 +14,7 @@ use "sleq"
use "strfind"
use "striter"
use "syswrap"
+use "traits"
use "utf"
pkg std =
@@ -61,7 +62,7 @@ const announcesock = {proto, str
| `None: -> `Err("invalid port")
;;
- if std.sleq(hoststr, "*")
+ if eq(hoststr, "*")
sa6=[.fam=sys.Afinet6, .port=hosttonet(port)]
sa = (&sa6 : sys.sockaddr#)
sz = sizeof(sys.sockaddr_in6)
diff --git a/lib/std/optparse.myr b/lib/std/optparse.myr
index 6202aa4..ec6c59d 100644
--- a/lib/std/optparse.myr
+++ b/lib/std/optparse.myr
@@ -2,12 +2,13 @@ use "alloc"
use "die"
use "extremum"
use "fmt"
-use "strbuf"
-use "option"
use "sleq"
+use "option"
use "slpush"
-use "syswrap-ss"
+use "strbuf"
use "syswrap"
+use "syswrap-ss"
+use "traits"
use "types"
use "utf"
@@ -166,7 +167,7 @@ const next = {ctx
for i = ctx.argidx + 1; i < ctx.optargs.len; i++
if !ctx.optdone && decode(ctx.optargs[i]) == '-'
- if sleq(ctx.optargs[i], "--")
+ if eq(ctx.optargs[i], "--")
ctx.optdone = true
else
goto foundopt
diff --git a/lib/std/pathjoin.myr b/lib/std/pathjoin.myr
index eb5e6fd..17d8a9f 100644
--- a/lib/std/pathjoin.myr
+++ b/lib/std/pathjoin.myr
@@ -1,13 +1,14 @@
use "alloc"
+use "die"
use "extremum"
-use "strjoin"
-use "strsplit"
+use "fmt"
use "sleq"
-use "sljoin"
-use "sldup"
use "slcp"
-use "die"
-use "fmt"
+use "sldup"
+use "sljoin"
+use "strjoin"
+use "strsplit"
+use "traits"
pkg std =
const pathcat : (a : byte[:], b : byte[:] -> byte[:])
@@ -45,7 +46,7 @@ const pathnorm = {p
and remove it later on.
*/
for i = 0; i < comps.len; i++
- if sleq(comps[i], ".")
+ if eq(comps[i], ".")
comps[i] = ""
;;
;;
@@ -59,11 +60,11 @@ const pathnorm = {p
get mangled.
*/
for i = 0; i < comps.len; i++
- if !sleq(comps[i], "..")
+ if !eq(comps[i], "..")
continue
;;
for del = 1; del <= i; del++
- if comps[i - del].len > 0 && !sleq(comps[i-del], "..")
+ if comps[i - del].len > 0 && !eq(comps[i-del], "..")
comps[i - del] = ""
comps[i] = ""
break
@@ -85,9 +86,9 @@ const pathnorm = {p
make it absolute. If we have an empty path, return
".". Otherwise, just return the path.
*/
- if p.len > 0 && sleq(p[:1], "/")
+ if p.len > 0 && eq(p[:1], "/")
for i = 0; i < comps.len; i++
- if !sleq(comps[i], "..")
+ if !eq(comps[i], "..")
break
;;
;;
diff --git a/lib/std/sleq.myr b/lib/std/sleq.myr
index 8e7fd6d..1e8d433 100644
--- a/lib/std/sleq.myr
+++ b/lib/std/sleq.myr
@@ -1,14 +1,91 @@
use "types"
+use "traits"
use "memops"
pkg std =
- generic sleq : (a : @a[:], b : @a[:] -> bool)
+ impl equatable @a[:]
+ impl equatable bool[:]
+ impl equatable byte[:]
+ impl equatable char[:]
+ impl equatable int8[:]
+ impl equatable int16[:]
+ impl equatable int[:]
+ impl equatable int32[:]
+ impl equatable int64[:]
+ impl equatable uint8[:]
+ impl equatable uint16[:]
+ impl equatable uint[:]
+ impl equatable uint32[:]
+ impl equatable uint64[:]
+ generic sleq : (a : @a[:], b : @a[:] -> bool)
;;
+/* for compatibility */
generic sleq = {a, b
- if a.len == b.len
- -> memeq((a : byte#), (b : byte#), a.len * sizeof(@a))
+ -> eq(a, b)
+}
+
+impl equatable @a[:] =
+ eq = {a, b
+ if a.len == b.len
+ -> false
+ ;;
+ /* can't use memeq because of padding */
+ for var i = 0; i < a.len; i++
+ if a[i] != b[i]
+ -> false
+ ;;
+ ;;
+ -> true
+ }
+;;
+
+impl equatable bool[:] =
+ eq = {a, b; -> primsleq((a : byte#), (b : byte#), a.len, b.len, sizeof(bool))}
+;;
+impl equatable byte[:] =
+ eq = {a, b; -> primsleq((a : byte#), (b : byte#), a.len, b.len, sizeof(byte))}
+;;
+impl equatable char[:] =
+ eq = {a, b; -> primsleq((a : byte#), (b : byte#), a.len, b.len, sizeof(char))}
+;;
+impl equatable int8[:] =
+ eq = {a, b; -> primsleq((a : byte#), (b : byte#), a.len, b.len, sizeof(int8))}
+;;
+impl equatable int16[:] =
+ eq = {a, b; -> primsleq((a : byte#), (b : byte#), a.len, b.len, sizeof(int16))}
+;;
+impl equatable int[:] =
+ eq = {a, b; -> primsleq((a : byte#), (b : byte#), a.len, b.len, sizeof(int))}
+;;
+impl equatable int32[:] =
+ eq = {a, b; -> primsleq((a : byte#), (b : byte#), a.len, b.len, sizeof(int32))}
+;;
+impl equatable int64[:] =
+ eq = {a, b; -> primsleq((a : byte#), (b : byte#), a.len, b.len, sizeof(int64))}
+;;
+impl equatable uint8[:] =
+ eq = {a, b; -> primsleq((a : byte#), (b : byte#), a.len, b.len, sizeof(uint8))}
+;;
+impl equatable uint16[:] =
+ eq = {a, b; -> primsleq((a : byte#), (b : byte#), a.len, b.len, sizeof(uint16))}
+;;
+impl equatable uint[:] =
+ eq = {a, b; -> primsleq((a : byte#), (b : byte#), a.len, b.len, sizeof(uint))}
+;;
+impl equatable uint32[:] =
+ eq = {a, b; -> primsleq((a : byte#), (b : byte#), a.len, b.len, sizeof(uint32))}
+;;
+
+impl equatable uint64[:] =
+ eq = {a, b; -> primsleq((a : byte#), (b : byte#), a.len, b.len, sizeof(uint64))}
+;;
+
+const primsleq = {a, b, na, nb, sz
+ if na == nb
+ -> memeq((a : byte#), (b : byte#), na * sz)
else
-> false
;;
}
+
diff --git a/lib/std/test/bigint.myr b/lib/std/test/bigint.myr
index ba8eaa1..33e1b91 100644
--- a/lib/std/test/bigint.myr
+++ b/lib/std/test/bigint.myr
@@ -35,7 +35,7 @@ const main = {
std.bigfree(e)
n = std.bigbfmt(buf[:], a, 0)
- std.assert(std.sleq(buf[:n], "517347321949036993306"), "simple smoke test failed")
+ std.assert(std.eq(buf[:n], "517347321949036993306"), "simple smoke test failed")
/* some comparison tests */
a = try(std.bigparse("1234_5678_1234_6789_6666_7777_8888"))
@@ -119,7 +119,7 @@ const run = {e : cmd#, res : byte[:]
v = eval(e)
n = std.bigbfmt(buf[:], v, 0)
- if !std.sleq(buf[:n], res)
+ if !std.eq(buf[:n], res)
std.fatal("{} != {}\n", buf[:n], res)
;;
}
diff --git a/lib/std/test/chomp.myr b/lib/std/test/chomp.myr
index 6bc9aa5..1816012 100644
--- a/lib/std/test/chomp.myr
+++ b/lib/std/test/chomp.myr
@@ -11,6 +11,6 @@ const check = {sl, pfx, expected
r = sl
std.chomp(&r, pfx)
- std.assert(std.sleq(r, expected), \
+ std.assert(std.eq(r, expected), \
"expected chomp({}, {}) => {}, got {}\n", sl, pfx, expected, r)
}
diff --git a/lib/std/test/dirname.myr b/lib/std/test/dirname.myr
index 8930f46..6795ec0 100644
--- a/lib/std/test/dirname.myr
+++ b/lib/std/test/dirname.myr
@@ -17,7 +17,7 @@ const main = {
}
const eq = {a, e
- if !std.sleq(e, a)
+ if !std.eq(e, a)
std.fatal("expected '{}', got '{}'\n", e, a)
;;
}
diff --git a/lib/std/test/fmt.myr b/lib/std/test/fmt.myr
index ec3fe85..da1b76a 100644
--- a/lib/std/test/fmt.myr
+++ b/lib/std/test/fmt.myr
@@ -21,7 +21,7 @@ const check = {expected, fmt, args : ...
ap = std.vastart(&args)
sl = std.bfmtv(buf[:], fmt, &ap)
- if !std.sleq(expected, sl)
+ if !std.eq(expected, sl)
std.fatal("mismatched fmt: got \"{}\", expected \"{}\"\n", sl, expected)
;;
}
diff --git a/lib/std/test/ipparse.myr b/lib/std/test/ipparse.myr
index fd6140a..dfed4d6 100644
--- a/lib/std/test/ipparse.myr
+++ b/lib/std/test/ipparse.myr
@@ -66,7 +66,7 @@ const eq = {ip, expected
parsed = std.ipparse(ip)
p = ipbytes(parsed)
e = ipbytes(expected)
- if !std.sleq(p, e)
+ if !std.eq(p, e)
std.fput(1, "misparsed ip {}\n", ip)
std.put("parsed: ")
for b : p
diff --git a/lib/std/test/netaddr.myr b/lib/std/test/netaddr.myr
index fd9ab84..1d6cac0 100644
--- a/lib/std/test/netaddr.myr
+++ b/lib/std/test/netaddr.myr
@@ -16,7 +16,7 @@ const matches = {ctx, expected, addr, net, port
var s
s = std.netaddr(addr, net, port)
- testr.check(ctx, std.sleq(expected, s), \
+ testr.check(ctx, std.eq(expected, s), \
"mismatch: expected {}, got {} from ({}, {}, {})\n", \
expected, s, addr, net, port)
std.slfree(s)
diff --git a/lib/std/test/pathjoin.myr b/lib/std/test/pathjoin.myr
index 0204184..4522af7 100644
--- a/lib/std/test/pathjoin.myr
+++ b/lib/std/test/pathjoin.myr
@@ -49,14 +49,14 @@ const norm = {a, b
var p
p = std.pathnorm(a)
- if !std.sleq(p, b)
+ if !std.eq(p, b)
std.fatal("mismatched paths: '{}' => '{}' != '{}'\n", a, p, b)
;;
std.slfree(p)
}
const eq = {a, b
- if !std.sleq(a, b)
+ if !std.eq(a, b)
std.fatal("mismatched paths: '{}' != '{}'\n", a, b)
;;
}
diff --git a/lib/std/test/slcp.myr b/lib/std/test/slcp.myr
index 07381c3..edb8050 100644
--- a/lib/std/test/slcp.myr
+++ b/lib/std/test/slcp.myr
@@ -18,7 +18,7 @@ const main = {
std.slcp(a[:a.len-2], a[2:])
std.slcp(b[2:], b[:b.len-2])
std.slcp(c[1:15], c[0:14])
- std.assert(std.sleq(a[:], a_cped[:]), "slcp of a failed: got {}, wanted {}", a[:], a_cped[:])
- std.assert(std.sleq(b[:], b_cped[:]), "slcp of b failed: got {}, wanted {}", b[:], b_cped[:])
- std.assert(std.sleq(c[:], c_cped[:]), "slcp of b failed: got {r}, wanted {r}", c[:], c_cped[:])
+ std.assert(std.eq(a[:], a_cped[:]), "slcp of a failed: got {}, wanted {}", a[:], a_cped[:])
+ std.assert(std.eq(b[:], b_cped[:]), "slcp of b failed: got {}, wanted {}", b[:], b_cped[:])
+ std.assert(std.eq(c[:], c_cped[:]), "slcp of b failed: got {r}, wanted {r}", c[:], c_cped[:])
}
diff --git a/lib/std/test/sleq.myr b/lib/std/test/sleq.myr
index c15807f..e9ffb59 100644
--- a/lib/std/test/sleq.myr
+++ b/lib/std/test/sleq.myr
@@ -12,14 +12,14 @@ const main = {
const wide = {c
var a : uint[3] = [ 0, 1, 2]
var b : uint[3] = [ 0, 1, 3]
- testr.check(c, !std.sleq(a[:], b[:]), "expected {} != {} as uint[:]", a, b)
+ testr.check(c, !std.eq(a[:], b[:]), "expected {} != {} as uint[:]", a, b)
}
const slices = {c
var a : int8[8] = [ 0, 0, 3, 1, 0, 3, 1, 2 ]
var b : int8[3] = [ 1, 0, 3]
- testr.check(c, std.sleq(a[1:4], a[4:7]), "expected {} = {}", a[1:4], a[4:7])
- testr.check(c, !std.sleq(a[0:4], a[3:7]), "expected {} = {}", a[0:4], a[3:7])
- testr.check(c, !std.sleq(a[:], b[:]), "expected {} = {}", a, b)
- testr.check(c, !std.sleq(a[3:7], b[:]), "expected {} = {}", a[3:7], b)
+ testr.check(c, std.eq(a[1:4], a[4:7]), "expected {} = {}", a[1:4], a[4:7])
+ testr.check(c, !std.eq(a[0:4], a[3:7]), "expected {} = {}", a[0:4], a[3:7])
+ testr.check(c, !std.eq(a[:], b[:]), "expected {} = {}", a, b)
+ testr.check(c, !std.eq(a[3:7], b[:]), "expected {} = {}", a[3:7], b)
}
diff --git a/lib/std/test/sort.myr b/lib/std/test/sort.myr
index e814623..61e39ae 100644
--- a/lib/std/test/sort.myr
+++ b/lib/std/test/sort.myr
@@ -12,16 +12,16 @@ const main = {
/* with custom intcmp */
std.sort(a[:], intcmp)
- std.assert(std.sleq(a[:], a_sorted[:]), "a was missorted")
+ std.assert(std.eq(a[:], a_sorted[:]), "a was missorted")
/* with libstd generic numcmp */
std.sort(b[:], std.numcmp)
- std.assert(std.sleq(b[:], b_sorted[:]), "b was missorted")
+ std.assert(std.eq(b[:], b_sorted[:]), "b was missorted")
/* string sorting */
std.sort(c[:], std.strcmp)
for i = 0; i < c.len; i++
- std.assert(std.sleq(c[i], c_sorted[i]), "c was missorted")
+ std.assert(std.eq(c[i], c_sorted[i]), "c was missorted")
;;
}
diff --git a/lib/std/test/strbuf.myr b/lib/std/test/strbuf.myr
index 2643da5..741ed39 100644
--- a/lib/std/test/strbuf.myr
+++ b/lib/std/test/strbuf.myr
@@ -5,36 +5,36 @@ const main = {
var buf : byte[16]
sb = std.mksb()
- std.assert(std.sleq(std.sbpeek(sb), ""), "mismatched empty str\n")
+ std.assert(std.eq(std.sbpeek(sb), ""), "mismatched empty str\n")
std.sbputs(sb, "hello")
- std.assert(std.sleq(std.sbpeek(sb), "hello"), "mismatched hello\n")
+ std.assert(std.eq(std.sbpeek(sb), "hello"), "mismatched hello\n")
std.sbputs(sb, ", hello")
- std.assert(std.sleq(std.sbpeek(sb), "hello, hello"), "mismatched double hello\n")
+ std.assert(std.eq(std.sbpeek(sb), "hello, hello"), "mismatched double hello\n")
std.sbtrim(sb, 7)
- std.assert(std.sleq(std.sbpeek(sb), "hello, "), "mismatched trim\n")
+ std.assert(std.eq(std.sbpeek(sb), "hello, "), "mismatched trim\n")
std.sbputs(sb, "world")
- std.assert(std.sleq(std.sbpeek(sb), "hello, world"), "mismatched hello world\n")
+ std.assert(std.eq(std.sbpeek(sb), "hello, world"), "mismatched hello world\n")
std.sbtrim(sb, -5)
- std.assert(std.sleq(std.sbpeek(sb), "hello, "), "mismatched rtrim\n")
+ std.assert(std.eq(std.sbpeek(sb), "hello, "), "mismatched rtrim\n")
std.sbputc(sb, '世')
std.sbputc(sb, '界')
- std.assert(std.sleq(std.sbpeek(sb), "hello, 世界"), "mismatched unicode\n")
+ std.assert(std.eq(std.sbpeek(sb), "hello, 世界"), "mismatched unicode\n")
std.sbputb(sb, 10)
- std.assert(std.sleq(std.sbpeek(sb), "hello, 世界\n"), "mismatched byte\n")
+ std.assert(std.eq(std.sbpeek(sb), "hello, 世界\n"), "mismatched byte\n")
sb = std.mkbufsb(buf[:])
std.assert(std.sbputs(sb, "hello"), "failed to add hello\n") /* 5 characters */
std.assert(std.sbputs(sb, "hello"), "failed to add hello\n") /* 10 characters */
std.assert(std.sbputs(sb, "hello"), "failed to add hello\n") /* 15 characters */
std.assert(!std.sbputs(sb, "hello"), "erronous success\n") /* 16 characters */
- std.assert(std.sleq(std.sbpeek(sb), "hellohellohelloh"), "failed to copy as much as possible\n")
+ std.assert(std.eq(std.sbpeek(sb), "hellohellohelloh"), "failed to copy as much as possible\n")
std.sbtrim(sb, -1)
- std.assert(std.sleq(std.sbpeek(sb), "hellohellohello"), "failed rtrim\n")
+ std.assert(std.eq(std.sbpeek(sb), "hellohellohello"), "failed rtrim\n")
std.sbputc(sb, '世')
- std.assert(std.sleq(std.sbpeek(sb), "hellohellohello"), "modified overflowed putc\n")
+ std.assert(std.eq(std.sbpeek(sb), "hellohellohello"), "modified overflowed putc\n")
std.sbtrim(sb, -2)
- std.assert(std.sleq(std.sbpeek(sb), "hellohellohel"), "failed rtrim\n")
+ std.assert(std.eq(std.sbpeek(sb), "hellohellohel"), "failed rtrim\n")
std.sbputc(sb, '世')
- std.assert(std.sleq(std.sbpeek(sb), "hellohellohel世"), "failed to append with putc\n")
+ std.assert(std.eq(std.sbpeek(sb), "hellohellohel世"), "failed to append with putc\n")
}
diff --git a/lib/std/test/strsplit.myr b/lib/std/test/strsplit.myr
index c70f6f6..bf81f41 100644
--- a/lib/std/test/strsplit.myr
+++ b/lib/std/test/strsplit.myr
@@ -36,7 +36,7 @@ const check = {a, b
std.fatal("length mismatch: {} != {}: {}\n", a.len, b.len)
;;
for var i = 0; i < a.len; i++
- if !std.sleq(a[i], b[i])
+ if !std.eq(a[i], b[i])
std.fatal("element {} mismatched: '{}' != '{}'\n", i, a[i], b[i])
;;
;;
diff --git a/lib/std/varargs.myr b/lib/std/varargs.myr
index 41ac903..f715b7c 100644
--- a/lib/std/varargs.myr
+++ b/lib/std/varargs.myr
@@ -1,6 +1,5 @@
use "types"
use "introspect"
-use "sleq"
use "die"
pkg std =