diff options
author | jofret | 2007-02-15 15:59:29 +0000 |
---|---|---|
committer | jofret | 2007-02-15 15:59:29 +0000 |
commit | 32500ab185a15201e2549caa4dd4c85ffbde1ba5 (patch) | |
tree | e4b4cb33d874f72c7a999e948d36b028dffbdb37 | |
parent | 3df2e8dd06389a2ea3d8f88876bd30a134a58ffd (diff) | |
download | scilab2c-32500ab185a15201e2549caa4dd4c85ffbde1ba5.tar.gz scilab2c-32500ab185a15201e2549caa4dd4c85ffbde1ba5.tar.bz2 scilab2c-32500ab185a15201e2549caa4dd4c85ffbde1ba5.zip |
-rw-r--r-- | src/auxiliaryFunctions/isempty/disEmptya.c | 4 | ||||
-rw-r--r-- | src/auxiliaryFunctions/isempty/sisEmptya.c | 4 | ||||
-rw-r--r-- | 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 <bruno.jofret@inria.fr> ** ** 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 <stdbool.h> #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 <bruno.jofret@inria.fr> ** ** 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 <stdbool.h> #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 <bruno.jofret@inria.fr> ** ** 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 <stdio.h> +#include <stdbool.h> + +#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); } |