Add test suite for the rope type in `gargoyle_from_rope`
This commit is contained in:
parent
eb0dfac697
commit
376aeb2124
|
@ -549,11 +549,13 @@ void scribe_test_from_rope(void) {
|
|||
uint64_t uint_val = 0;
|
||||
int64_t sint_val = 0;
|
||||
double dble_val = 0;
|
||||
char rope_val[10];
|
||||
|
||||
struct gargoyle_opt opts[] = {
|
||||
{ GARGOYLE_EZ_OPT("uint", uint_val), GARGOYLE_TYPE_UINT },
|
||||
{ GARGOYLE_EZ_OPT("sint", sint_val), GARGOYLE_TYPE_SINT },
|
||||
{ GARGOYLE_EZ_OPT("dble", dble_val), GARGOYLE_TYPE_DBLE }
|
||||
{ GARGOYLE_EZ_OPT("dble", dble_val), GARGOYLE_TYPE_DBLE },
|
||||
{ GARGOYLE_CS_OPT("rope", rope_val), GARGOYLE_TYPE_ROPE }
|
||||
};
|
||||
|
||||
uint8_t res = gargoyle_from_rope(&opts[0], "42", 0);
|
||||
|
@ -650,4 +652,16 @@ void scribe_test_from_rope(void) {
|
|||
res = gargoyle_from_rope(&opts[2], "-8.19", 0);
|
||||
CU_ASSERT_EQUAL(res, GARGOYLE_ERR_SUCCESS);
|
||||
CU_ASSERT_DOUBLE_EQUAL(dble_val, -8.19, 0.0);
|
||||
|
||||
res = gargoyle_from_rope(&opts[3], "Hello, world!", 0);
|
||||
CU_ASSERT_EQUAL(res, GARGOYLE_ERR_SUCCESS);
|
||||
CU_ASSERT_NSTRING_EQUAL(rope_val, "Hello, wo", 9);
|
||||
|
||||
res = gargoyle_from_rope(&opts[3], "Hello!", 0);
|
||||
CU_ASSERT_EQUAL(res, GARGOYLE_ERR_SUCCESS);
|
||||
CU_ASSERT_NSTRING_EQUAL(rope_val, "Hello!", 9);
|
||||
|
||||
res = gargoyle_from_rope(&opts[3], "Thunderfury, Blessed Blade of the Windseeker", 0);
|
||||
CU_ASSERT_EQUAL(res, GARGOYLE_ERR_SUCCESS);
|
||||
CU_ASSERT_NSTRING_EQUAL(rope_val, "Thunderfu", 9);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue