|
@@ -12,7 +12,7 @@ int main(void)
|
|
|
struct bytestring bs, bs1, bs2, bs3, bs4, bs5;
|
|
struct bytestring bs, bs1, bs2, bs3, bs4, bs5;
|
|
|
|
|
|
|
|
/* This is how many tests you plan to run */
|
|
/* This is how many tests you plan to run */
|
|
|
- plan_tests(16);
|
|
|
|
|
|
|
+ plan_tests(22);
|
|
|
|
|
|
|
|
bs = bytestring(str1, sizeof(str1) - 1);
|
|
bs = bytestring(str1, sizeof(str1) - 1);
|
|
|
ok1(bs.ptr == str1);
|
|
ok1(bs.ptr == str1);
|
|
@@ -42,7 +42,14 @@ int main(void)
|
|
|
ok1(bytestring_byte(bs2, 4) == 'd');
|
|
ok1(bytestring_byte(bs2, 4) == 'd');
|
|
|
ok1(bytestring_byte(bs2, 5) == 'e');
|
|
ok1(bytestring_byte(bs2, 5) == 'e');
|
|
|
ok1(bytestring_byte(bs2, 6) == 'f');
|
|
ok1(bytestring_byte(bs2, 6) == 'f');
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+ ok1(bytestring_eq(bytestring_slice(bs, 0, 4), BYTESTRING("test")));
|
|
|
|
|
+ ok1(bytestring_eq(bytestring_slice(bs, 5, 8), BYTESTRING("str")));
|
|
|
|
|
+ ok1(bytestring_eq(bytestring_slice(bs2, 2, 5), BYTESTRING("c\0d")));
|
|
|
|
|
+ ok1(bytestring_eq(bytestring_slice(bs2, 0, -1U), bs2));
|
|
|
|
|
+ ok1(bytestring_eq(bytestring_slice(bs2, 10, 20), bytestring_NULL));
|
|
|
|
|
+ ok1(bytestring_eq(bytestring_slice(bs2, 2, 1), bytestring_NULL));
|
|
|
|
|
+
|
|
|
/* This exits depending on whether all tests passed */
|
|
/* This exits depending on whether all tests passed */
|
|
|
return exit_status();
|
|
return exit_status();
|
|
|
}
|
|
}
|