summaryrefslogtreecommitdiff
path: root/bytes/bytes_test.ts
diff options
context:
space:
mode:
authorYusuke Sakurai <kerokerokerop@gmail.com>2019-02-11 08:49:48 +0900
committerRyan Dahl <ry@tinyclouds.org>2019-02-10 18:49:48 -0500
commit33f62789cde407059abba0a7ac18b2145c648ea7 (patch)
tree454d487f232a61f6c57e2ebdad66e49bf939e4d6 /bytes/bytes_test.ts
parented20bda6ec324b8143c6210024647d2692232c26 (diff)
feat: multipart, etc.. (denoland/deno_std#180)
Original: https://github.com/denoland/deno_std/commit/fda9c98d055091fa886fa444ebd1adcd2ecd21bc
Diffstat (limited to 'bytes/bytes_test.ts')
-rw-r--r--bytes/bytes_test.ts36
1 files changed, 36 insertions, 0 deletions
diff --git a/bytes/bytes_test.ts b/bytes/bytes_test.ts
new file mode 100644
index 000000000..3d87497fe
--- /dev/null
+++ b/bytes/bytes_test.ts
@@ -0,0 +1,36 @@
+import {
+ bytesFindIndex,
+ bytesFindLastIndex,
+ bytesEqual,
+ bytesHasPrefix
+} from "./bytes.ts";
+import { assertEqual, test } from "./deps.ts";
+
+test(function bytesBytesFindIndex() {
+ const i = bytesFindIndex(
+ new Uint8Array([1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 3]),
+ new Uint8Array([0, 1, 2])
+ );
+ assertEqual(i, 2);
+});
+
+test(function bytesBytesFindLastIndex1() {
+ const i = bytesFindLastIndex(
+ new Uint8Array([0, 1, 2, 0, 1, 2, 0, 1, 3]),
+ new Uint8Array([0, 1, 2])
+ );
+ assertEqual(i, 3);
+});
+
+test(function bytesBytesBytesEqual() {
+ const v = bytesEqual(
+ new Uint8Array([0, 1, 2, 3]),
+ new Uint8Array([0, 1, 2, 3])
+ );
+ assertEqual(v, true);
+});
+
+test(function bytesBytesHasPrefix() {
+ const v = bytesHasPrefix(new Uint8Array([0, 1, 2]), new Uint8Array([0, 1]));
+ assertEqual(v, true);
+});