From 32500ab185a15201e2549caa4dd4c85ffbde1ba5 Mon Sep 17 00:00:00 2001 From: jofret Date: Thu, 15 Feb 2007 15:59:29 +0000 Subject: --- src/auxiliaryFunctions/isempty/disEmptya.c | 4 +- src/auxiliaryFunctions/isempty/sisEmptya.c | 4 +- src/test/testIsEmpty.c | 69 ++++++++++++++++++++++++++++-- 3 files changed, 70 insertions(+), 7 deletions(-) diff --git a/src/auxiliaryFunctions/isempty/disEmptya.c b/src/auxiliaryFunctions/isempty/disEmptya.c index 7ffb3a1a..985d057e 100644 --- a/src/auxiliaryFunctions/isempty/disEmptya.c +++ b/src/auxiliaryFunctions/isempty/disEmptya.c @@ -5,7 +5,7 @@ ** Made by Bruno JOFRET ** ** Started on Wed Feb 14 15:29:27 2007 jofret -** Last update Wed Feb 14 15:29:54 2007 jofret +** Last update Thu Feb 15 16:35:20 2007 jofret ** ** Copyright INRIA 2007 */ @@ -13,7 +13,7 @@ #include #include "notFound.h" -int dfinda(double*, int); +int dfinda(double*, int); bool disEmptya(double* x, int size) { if (dfinda(x, size) == NOT_FOUND) { diff --git a/src/auxiliaryFunctions/isempty/sisEmptya.c b/src/auxiliaryFunctions/isempty/sisEmptya.c index af8a9860..c98fce46 100644 --- a/src/auxiliaryFunctions/isempty/sisEmptya.c +++ b/src/auxiliaryFunctions/isempty/sisEmptya.c @@ -5,7 +5,7 @@ ** Made by Bruno JOFRET ** ** Started on Wed Feb 14 14:59:33 2007 jofret -** Last update Wed Feb 14 15:25:32 2007 jofret +** Last update Thu Feb 15 16:53:35 2007 jofret ** ** Copyright INRIA 2007 */ @@ -13,7 +13,7 @@ #include #include "notFound.h" -int sfinda(float*, int); +extern int sfinda(float*, int); bool sisEmptya(float* x, int size) { if (sfinda(x, size) == NOT_FOUND) { diff --git a/src/test/testIsEmpty.c b/src/test/testIsEmpty.c index 123376a6..899d3253 100644 --- a/src/test/testIsEmpty.c +++ b/src/test/testIsEmpty.c @@ -5,15 +5,78 @@ ** Made by Bruno JOFRET ** ** Started on Wed Feb 14 16:07:57 2007 jofret -** Last update Wed Feb 14 17:31:54 2007 jofret +** Last update Thu Feb 15 16:32:47 2007 jofret ** ** Copyright INRIA 2007 */ #include +#include + +#define ERROR 51 + +bool sisEmptya(float*, int); +bool disEmptya(double*, int); + +int sisemptyaTest() { + printf(">> Float array\n"); + float empty[5] = {0., 0., 0., 0., 0.}; + float full[5] = {1., 2., 3., 0., 0.}; + + if (sisEmptya(empty, 5) == false) { + printf("ERROR ! : Test Failed (empty array)\n"); + return ERROR; + } + + if (sisEmptya(full, 5) == true) { + printf("ERROR ! : Test Failed (non empty array)\n"); + return ERROR; + } + + return 0; +} + +int disemptyaTest() { + printf(">> Double array\n"); + + double empty[5] = {0., 0., 0., 0., 0.}; + /* + double full[5] = {1., 2., 3., 0., 0.}; + */ + if (disEmptya(empty, 5) == false) { + printf("ERROR ! : Test Failed (empty array)\n"); + return ERROR; + } + /* + if (disEmptya(full, 5) == true) { + printf("ERROR ! : Test Failed (non empty array)\n"); + return ERROR; + } + */ + return 0; +} + +int cisemptyaTest() { + printf(">> Float Complex array\n"); + + return 0; +} + +int zisemptyaTest() { + printf(">> Double Complex array\n"); + return 0; +} + int testIsEmpty() { + int sisemptyaTestStatus, disemptyaTestStatus = 0; + int cisemptyaTestStatus, zisemptyaTestStatus = 0; printf("\n>>>> IsEmpty Tests\n"); - /* FIXME : Implement some test here ... */ - return 0; + sisemptyaTestStatus = sisemptyaTest(); + disemptyaTestStatus = disemptyaTest(); + cisemptyaTestStatus = cisemptyaTest(); + zisemptyaTestStatus = zisemptyaTest(); + + return (sisemptyaTestStatus + disemptyaTestStatus + + cisemptyaTestStatus + zisemptyaTestStatus); } -- cgit