summaryrefslogtreecommitdiff
path: root/src/auxiliaryFunctions/isempty/testIsEmpty.c
diff options
context:
space:
mode:
authorjofret2007-04-27 06:47:30 +0000
committerjofret2007-04-27 06:47:30 +0000
commitd4c521386b82ea3e29762a845bc4483f57bc056a (patch)
treec1b258c1346165dbd4179f5e6b322b2d07b96634 /src/auxiliaryFunctions/isempty/testIsEmpty.c
parent0b52f43b5ceccad148877b3def021a41c46501c3 (diff)
downloadscilab2c-d4c521386b82ea3e29762a845bc4483f57bc056a.tar.gz
scilab2c-d4c521386b82ea3e29762a845bc4483f57bc056a.tar.bz2
scilab2c-d4c521386b82ea3e29762a845bc4483f57bc056a.zip
[RELEASE] isEmpty functions ! (with simple low case name)
Diffstat (limited to 'src/auxiliaryFunctions/isempty/testIsEmpty.c')
-rw-r--r--src/auxiliaryFunctions/isempty/testIsEmpty.c97
1 files changed, 79 insertions, 18 deletions
diff --git a/src/auxiliaryFunctions/isempty/testIsEmpty.c b/src/auxiliaryFunctions/isempty/testIsEmpty.c
index 041db1e2..b5e138e6 100644
--- a/src/auxiliaryFunctions/isempty/testIsEmpty.c
+++ b/src/auxiliaryFunctions/isempty/testIsEmpty.c
@@ -5,63 +5,119 @@
** Made by Bruno JOFRET <bruno.jofret@inria.fr>
**
** Started on Wed Feb 14 16:07:57 2007 jofret
-** Last update Fri Feb 23 18:09:19 2007 jofret
+** Last update Fri Apr 27 09:00:55 2007 jofret
**
** Copyright INRIA 2007
*/
-#include <stdio.h>
-
-#include "isEmpty.h"
-
-#define ERROR 51
+#include "testIsEmpty.h"
int sisemptyaTest() {
+ int result = 0;
+
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) {
+ if (sisemptya(empty, 5) == false) {
printf("ERROR ! : Test Failed (empty array)\n");
- return ERROR;
+ result = ERROR;
}
+ assert (sisemptya(empty, 5) == true);
- if (sisEmptya(full, 5) == true) {
+ if (sisemptya(full, 5) == true) {
printf("ERROR ! : Test Failed (non empty array)\n");
- return ERROR;
+ result = ERROR;
}
+ assert(sisemptya(full, 5) == false);
- return 0;
+ return result;
}
int disemptyaTest() {
+ int result = 0;
+
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) {
+ if (disemptya(empty, 5) == false) {
printf("ERROR ! : Test Failed (empty array)\n");
- return ERROR;
+ result = ERROR;
}
+ assert(disemptya(empty, 5) == true);
- if (disEmptya(full, 5) == true) {
+ if (disemptya(full, 5) == true) {
printf("ERROR ! : Test Failed (non empty array)\n");
- return ERROR;
+ result = ERROR;
}
+ assert(disemptya(full, 5) == false);
- return 0;
+ return result;
}
int cisemptyaTest() {
+ int result = 0;
printf(">> Float Complex array\n");
- return 0;
+ floatComplex empty[5] = {FloatComplex(0., 0.),
+ FloatComplex(0., 0.),
+ FloatComplex(0., 0.),
+ FloatComplex(0., 0.),
+ FloatComplex(0., 0.)};
+ floatComplex full[5] = {FloatComplex(0.,1.),
+ FloatComplex(0., 2.),
+ FloatComplex(0., 3.),
+ FloatComplex(0., 0.),
+ FloatComplex(0., 0.)};
+
+ if (cisemptya(empty, 5) == false) {
+ printf("ERROR ! : Test Failed (empty array)\n");
+ result = ERROR;
+ }
+ assert (cisemptya(empty, 5) == true);
+
+ if (cisemptya(full, 5) == true) {
+ printf("ERROR ! : Test Failed (non empty array)\n");
+ result = ERROR;
+ }
+ assert(cisemptya(full, 5) == false);
+
+
+ return result;
}
int zisemptyaTest() {
+ int result = 0;
+
printf(">> Double Complex array\n");
- return 0;
+ doubleComplex empty[5] = {DoubleComplex(0., 0.),
+ DoubleComplex(0., 0.),
+ DoubleComplex(0., 0.),
+ DoubleComplex(0., 0.),
+ DoubleComplex(0., 0.)};
+ doubleComplex full[5] = {DoubleComplex(0.,1.),
+ DoubleComplex(0., 2.),
+ DoubleComplex(0., 3.),
+ DoubleComplex(0., 0.),
+ DoubleComplex(0., 0.)};
+
+ if (zisemptya(empty, 5) == false) {
+ printf("ERROR ! : Test Failed (empty array)\n");
+ result = ERROR;
+ }
+ assert (zisemptya(empty, 5) == true);
+
+ if (zisemptya(full, 5) == true) {
+ printf("ERROR ! : Test Failed (non empty array)\n");
+ result = ERROR;
+ }
+ assert(zisemptya(full, 5) == false);
+
+
+ return result;
}
@@ -77,3 +133,8 @@ int testIsEmpty() {
return (sisemptyaTestStatus + disemptyaTestStatus +
cisemptyaTestStatus + zisemptyaTestStatus);
}
+
+int main(void) {
+ assert(testIsEmpty() == 0);
+ return 0;
+}