summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2010-10-22 21:52:25 +0100
committerLars Wirzenius <liw@liw.fi>2010-10-22 21:52:25 +0100
commite68e53a99c1c27acd156faf685ef2a07315ecfd1 (patch)
tree78517f99e8922d8b6791e54e4a8b00a038a2a04d
parent92274449dd371313252bd36c99b85aef29b8d30a (diff)
downloaddynstr-e68e53a99c1c27acd156faf685ef2a07315ecfd1.tar.gz
Add test for byte_at for 8-bit bytes.
-rw-r--r--unittests.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/unittests.c b/unittests.c
index fcd740b..e651ea9 100644
--- a/unittests.c
+++ b/unittests.c
@@ -540,6 +540,17 @@ static int test_byteat_reports_error_for_too_large_offset(void)
}
+static int test_byteat_reports_0xff_correctly(void)
+{
+ Dynstr *dynstr;
+
+ dynstr = dynstr_new_from_cstring("\xff");
+ FAIL_UNLESS_EQUAL(dynstr_byte_at(dynstr, 0), 255);
+ dynstr_free(dynstr);
+ return true;
+}
+
+
static void setup(void)
{
dynstr_init();
@@ -594,6 +605,7 @@ static const struct test tests[] = {
TEST(test_cat_returns_NULL_for_second_malloc_failure),
TEST(test_byteat_reports_correct_character),
TEST(test_byteat_reports_error_for_too_large_offset),
+ TEST(test_byteat_reports_0xff_correctly),
};
static const int num_tests = sizeof(tests) / sizeof(tests[0]);