diff --git a/tests/lib/mocklib/uci.uc b/tests/lib/mocklib/uci.uc index 542eeb8..015c602 100644 --- a/tests/lib/mocklib/uci.uc +++ b/tests/lib/mocklib/uci.uc @@ -1,11 +1,16 @@ {% let mocklib = global.mocklib; + let byte = (str, off) => { + let v = ord(str, off); + return length(v) ? v[0] : v; + }; + let hash = (s) => { let h = 7; for (let i = 0; i < length(s); i++) - h = h * 31 + ord(s, i)[0]; + h = h * 31 + byte(s, i); return h; };