|
|
|
@ -12,77 +12,77 @@ int clean_suite_sleuth(void) {
|
|
|
|
|
|
|
|
|
|
void sleuth_test_find_brand(void) { |
|
|
|
|
struct gargoyle_optn optv[] = { |
|
|
|
|
{ GARGOYLE_MK_OPTN("baz"), 0, NULL, 0, GARGOYLE_TYPE_DBLE }, |
|
|
|
|
{ GARGOYLE_MK_OPTN("foo"), 0, NULL, 0, GARGOYLE_TYPE_BOOL }, |
|
|
|
|
{ GARGOYLE_MK_OPTN("bar"), 0, NULL, 0, GARGOYLE_TYPE_UINT } |
|
|
|
|
{ GARGOYLE_MK_OPTN("baz"), 0, "no-", 3, GARGOYLE_TYPE_DBLE }, |
|
|
|
|
{ GARGOYLE_MK_OPTN("foo"), 0, "no-", 3, GARGOYLE_TYPE_BOOL }, |
|
|
|
|
{ GARGOYLE_MK_OPTN("bar"), 0, "no-", 3, GARGOYLE_TYPE_UINT } |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
uint16_t optc = sizeof(optv) / sizeof(struct gargoyle_optn); |
|
|
|
|
|
|
|
|
|
struct gargoyle_optn *optn = gargoyle_find_brand(optc, optv, "", NULL, 0, 0); |
|
|
|
|
struct gargoyle_optn *optn = gargoyle_find_brand(optc, optv, "", "no-", 3, 0); |
|
|
|
|
CU_ASSERT_PTR_NULL(optn); |
|
|
|
|
|
|
|
|
|
optn = gargoyle_find_brand(optc, optv, "foo", NULL, 0, 0); |
|
|
|
|
optn = gargoyle_find_brand(optc, optv, "foo", "no-", 3, 0); |
|
|
|
|
CU_ASSERT_PTR_NOT_NULL(optn); |
|
|
|
|
CU_ASSERT_NSTRING_EQUAL(optn->brand, "foo", optn->brand_sz); |
|
|
|
|
|
|
|
|
|
optn = gargoyle_find_brand(optc, optv, "no-foo", NULL, 0, 0); |
|
|
|
|
optn = gargoyle_find_brand(optc, optv, "no-foo", "no-", 3, 0); |
|
|
|
|
CU_ASSERT_PTR_NOT_NULL(optn); |
|
|
|
|
CU_ASSERT_NSTRING_EQUAL(optn->brand, "foo", optn->brand_sz); |
|
|
|
|
|
|
|
|
|
optn = gargoyle_find_brand(optc, optv, "no-foo", "", 0, 0); |
|
|
|
|
CU_ASSERT_PTR_NULL(optn); |
|
|
|
|
|
|
|
|
|
optn = gargoyle_find_brand(optc, optv, "no_foo", NULL, 0, GARGOYLE_FLG_SYMBL); |
|
|
|
|
optn = gargoyle_find_brand(optc, optv, "no_foo", "no-", 3, GARGOYLE_FLG_SYMBL); |
|
|
|
|
CU_ASSERT_PTR_NOT_NULL(optn); |
|
|
|
|
CU_ASSERT_NSTRING_EQUAL(optn->brand, "foo", optn->brand_sz); |
|
|
|
|
|
|
|
|
|
optn = gargoyle_find_brand(optc, optv, "no_foo", NULL, 0, GARGOYLE_FLG_ICASE); |
|
|
|
|
optn = gargoyle_find_brand(optc, optv, "no_foo", "no-", 3, GARGOYLE_FLG_ICASE); |
|
|
|
|
CU_ASSERT_PTR_NULL(optn); |
|
|
|
|
|
|
|
|
|
optn = gargoyle_find_brand(optc, optv, "no_foo", NULL, 0, 0); |
|
|
|
|
optn = gargoyle_find_brand(optc, optv, "no_foo", "no-", 3, 0); |
|
|
|
|
CU_ASSERT_PTR_NULL(optn); |
|
|
|
|
|
|
|
|
|
optn = gargoyle_find_brand(optc, optv, "No-Foo", NULL, 0, GARGOYLE_FLG_SYMBL); |
|
|
|
|
optn = gargoyle_find_brand(optc, optv, "No-Foo", "no-", 3, GARGOYLE_FLG_SYMBL); |
|
|
|
|
CU_ASSERT_PTR_NULL(optn); |
|
|
|
|
|
|
|
|
|
optn = gargoyle_find_brand(optc, optv, "No-Foo", NULL, 0, GARGOYLE_FLG_ICASE); |
|
|
|
|
optn = gargoyle_find_brand(optc, optv, "No-Foo", "no-", 3, GARGOYLE_FLG_ICASE); |
|
|
|
|
CU_ASSERT_PTR_NOT_NULL(optn); |
|
|
|
|
CU_ASSERT_NSTRING_EQUAL(optn->brand, "foo", optn->brand_sz); |
|
|
|
|
|
|
|
|
|
optn = gargoyle_find_brand(optc, optv, "No-Foo", NULL, 0, 0); |
|
|
|
|
optn = gargoyle_find_brand(optc, optv, "No-Foo", "no-", 3, 0); |
|
|
|
|
CU_ASSERT_PTR_NULL(optn); |
|
|
|
|
|
|
|
|
|
optn = gargoyle_find_brand(optc, optv, "NO_FOO", NULL, 0, GARGOYLE_FLG_FLXBL); |
|
|
|
|
optn = gargoyle_find_brand(optc, optv, "NO_FOO", "no-", 3, GARGOYLE_FLG_FLXBL); |
|
|
|
|
CU_ASSERT_PTR_NOT_NULL(optn); |
|
|
|
|
CU_ASSERT_NSTRING_EQUAL(optn->brand, "foo", optn->brand_sz); |
|
|
|
|
|
|
|
|
|
optn = gargoyle_find_brand(optc, optv, "bar", NULL, 0, 0); |
|
|
|
|
optn = gargoyle_find_brand(optc, optv, "bar", "no-", 3, 0); |
|
|
|
|
CU_ASSERT_PTR_NOT_NULL(optn); |
|
|
|
|
CU_ASSERT_NSTRING_EQUAL(optn->brand, "bar", optn->brand_sz); |
|
|
|
|
|
|
|
|
|
optn = gargoyle_find_brand(optc, optv, "ba", NULL, 0, 0); |
|
|
|
|
optn = gargoyle_find_brand(optc, optv, "ba", "no-", 3, 0); |
|
|
|
|
CU_ASSERT_PTR_NULL(optn); |
|
|
|
|
|
|
|
|
|
optn = gargoyle_find_brand(optc, optv, "baro", NULL, 0, 0); |
|
|
|
|
optn = gargoyle_find_brand(optc, optv, "baro", "no-", 3, 0); |
|
|
|
|
CU_ASSERT_PTR_NULL(optn); |
|
|
|
|
|
|
|
|
|
optn = gargoyle_find_brand(optc, optv, "floor", NULL, 0, 0); |
|
|
|
|
optn = gargoyle_find_brand(optc, optv, "floor", "no-", 3, 0); |
|
|
|
|
CU_ASSERT_PTR_NULL(optn); |
|
|
|
|
|
|
|
|
|
optn = gargoyle_find_brand(optc, optv, "harrow", NULL, 0, 0); |
|
|
|
|
optn = gargoyle_find_brand(optc, optv, "harrow", "no-", 3, 0); |
|
|
|
|
CU_ASSERT_PTR_NULL(optn); |
|
|
|
|
|
|
|
|
|
optn = gargoyle_find_brand(optc, optv, "$#^*!@&(*(@&", NULL, 0, 0); |
|
|
|
|
optn = gargoyle_find_brand(optc, optv, "$#^*!@&(*(@&", "no-", 3, 0); |
|
|
|
|
CU_ASSERT_PTR_NULL(optn); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void sleuth_test_find_emblem(void) { |
|
|
|
|
struct gargoyle_optn optv[] = { |
|
|
|
|
{ GARGOYLE_MK_OPTN("glu"), 'G', NULL, 0, GARGOYLE_TYPE_UINT }, |
|
|
|
|
{ GARGOYLE_MK_OPTN("foo"), 'f', NULL, 0, GARGOYLE_TYPE_BOOL }, |
|
|
|
|
{ GARGOYLE_MK_OPTN("bar"), 'b', NULL, 0, GARGOYLE_TYPE_DBLE }, |
|
|
|
|
{ GARGOYLE_MK_OPTN("blu"), 'B', NULL, 0, GARGOYLE_TYPE_UINT } |
|
|
|
|
{ GARGOYLE_MK_OPTN("glu"), 'G', "no-", 3, GARGOYLE_TYPE_UINT }, |
|
|
|
|
{ GARGOYLE_MK_OPTN("foo"), 'f', "no-", 3, GARGOYLE_TYPE_BOOL }, |
|
|
|
|
{ GARGOYLE_MK_OPTN("bar"), 'b', "no-", 3, GARGOYLE_TYPE_DBLE }, |
|
|
|
|
{ GARGOYLE_MK_OPTN("blu"), 'B', "no-", 3, GARGOYLE_TYPE_UINT } |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
uint16_t optc = sizeof(optv) / sizeof(struct gargoyle_optn); |
|
|
|
|