From 28a5cd543a87d1adcd461fee4c71a2b937168167 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Tue, 11 Jun 2019 12:01:35 -0400 Subject: [PATCH] Started writing the uiControl error tests. --- test/controls.c | 14 ++++++++++---- test/controls_errors.h | 12 ++++++++++++ 2 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 test/controls_errors.h diff --git a/test/controls.c b/test/controls.c index a2a08483..70fa3285 100644 --- a/test/controls.c +++ b/test/controls.c @@ -24,17 +24,23 @@ static void testVtableTestMethod(uiControl *c, void *implData) // do nothing } -static void createTestVtables(uiControlVtable *vtable, uiControlOSVtable **osVtable) +static void createTestVtable(uiControlVtable *vtable) { memset(&vtable, 0, sizeof (uiControlVtable)); vtable.Size = sizeof (uiControlVtable); vtable.Init = testVtableInit; vtable.Free = testVtableFree; - memset(&osVtable, 0, sizeof (struct testOSVtable)); - osVtable.Size = sizeof (struct testOSVtable); - osVtable.TestMethod = testVtableTestMethod; } +// TODO namePlaceholder == "name" +struct checkControlErrorsParams { + const char *namePlaceholder; + uiControlVtable *vtablePlaceholder; + uiControlOSVtable *osVtablePlaceholder; + size_t implDataSizePlaceholder; + uiControlVtable *badSizeVtable; +}; + testingTest(ControlErrors) { uiControlVtable vtablePlacheolder, vtableBadSize; diff --git a/test/controls_errors.h b/test/controls_errors.h new file mode 100644 index 00000000..4c9c010d --- /dev/null +++ b/test/controls_errors.h @@ -0,0 +1,12 @@ +// 11 june 2019 + +checkErrorCase(uiRegisterControlType(NULL, p->vtablePlaceholder, p->osVtablePlaceholder, p->implDataSizePlaceholder), + "TODO") +checkErrorCase(uiRegisterControlType(p->namePlaceholder, NULL, p->osVtablePlaceholder, p->implDataSizePlaceholder), + "TODO") +checkErrorCase(uiRegisterControlType(p->namePlaceholder, p->badVtableSize, p->osVtablePlaceholder, p->implDataSizePlaceholder), + "TODO"); +// TODO individual methods +checkErrorCase(uiRegisterControlType(p->namePlaceholder, p->vtablePlaceholder, NULL, p->implDataSizePlaceholder), + "TODO"); +// OS vtable sizes are tested per-OS