summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsimon2009-07-16 09:10:23 +0000
committersimon2009-07-16 09:10:23 +0000
commit0019d6a1d68d0500e0b58a673e187162c222263a (patch)
tree636638f11861f946b11fce81604810ddae1f6948
parentcb6d500415f8db3078cc95ece2a4bfabb4e50489 (diff)
downloadscilab2c-0019d6a1d68d0500e0b58a673e187162c222263a.tar.gz
scilab2c-0019d6a1d68d0500e0b58a673e187162c222263a.tar.bz2
scilab2c-0019d6a1d68d0500e0b58a673e187162c222263a.zip
added test for OpRc , OpCc and OpMinus
corrected the interfaces of OpCc and OpRc added the missing combinations in INIT_FillSCI2LibCDirs.sci and updated it
-rw-r--r--macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci21
-rw-r--r--src/c/matrixOperations/interfaces/int_OpCc.h33
-rw-r--r--src/c/matrixOperations/interfaces/int_OpRc.h34
-rw-r--r--tests/unit_tests/test_double_OpCc.sci46
-rw-r--r--tests/unit_tests/test_double_OpMinus.sci45
-rw-r--r--tests/unit_tests/test_double_OpRc.sci45
6 files changed, 202 insertions, 22 deletions
diff --git a/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci b/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci
index 2bc27224..ca6c05c4 100644
--- a/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci
+++ b/macros/ToolInitialization/INIT_FillSCI2LibCDirs.sci
@@ -1207,7 +1207,7 @@ PrintStringInfo('z2z2'+ArgSeparator+'z2',ClassFileName,'file','y');
// --- Annotation Function And Function List Function. ---
-FunctionName = 'OpMinus';
+FunctionName = 'OpMinus'; // AS : Done
PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'both','y');
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
@@ -1259,8 +1259,18 @@ PrintStringInfo('s2c0'+ArgSeparator+'c2',ClassFileName,'file','y');
PrintStringInfo('d0z0'+ArgSeparator+'z2',ClassFileName,'file','y');
PrintStringInfo('d2z0'+ArgSeparator+'z2',ClassFileName,'file','y');
+PrintStringInfo('s2c2'+ArgSeparator+'c2',ClassFileName,'file','y');
+PrintStringInfo('c2s2'+ArgSeparator+'c2',ClassFileName,'file','y');
+PrintStringInfo('d2z2'+ArgSeparator+'z2',ClassFileName,'file','y');
+PrintStringInfo('z2d2'+ArgSeparator+'z2',ClassFileName,'file','y');
+
+PrintStringInfo('s0c2'+ArgSeparator+'c2',ClassFileName,'file','y');
+PrintStringInfo('c0s2'+ArgSeparator+'c2',ClassFileName,'file','y');
+PrintStringInfo('d0z2'+ArgSeparator+'z2',ClassFileName,'file','y');
+PrintStringInfo('z0d2'+ArgSeparator+'z2',ClassFileName,'file','y');
+
// --- Annotation Function And Function List Function. ---
-FunctionName = 'OpRc';
+FunctionName = 'OpRc'; // AS : Done
PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'both','y');
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
@@ -1317,8 +1327,13 @@ PrintStringInfo('c2s2'+ArgSeparator+'c2',ClassFileName,'file','y');
PrintStringInfo('d2z2'+ArgSeparator+'z2',ClassFileName,'file','y');
PrintStringInfo('z2d2'+ArgSeparator+'z2',ClassFileName,'file','y');
+PrintStringInfo('s0c2'+ArgSeparator+'c2',ClassFileName,'file','y');
+PrintStringInfo('c0s2'+ArgSeparator+'c2',ClassFileName,'file','y');
+PrintStringInfo('d0z2'+ArgSeparator+'z2',ClassFileName,'file','y');
+PrintStringInfo('z0d2'+ArgSeparator+'z2',ClassFileName,'file','y');
+
// --- Annotation Function And Function List Function. ---
-FunctionName = 'OpCc';
+FunctionName = 'OpCc'; // AS : Done
PrintStringInfo(' Adding Function: '+FunctionName+'.',GeneralReport,'both','y');
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCAnnFunDir,ClassName,GeneralReport,ExtensionCAnnFun);
INIT_GenAnnFLFunctions(FunctionName,SCI2CLibCFLFunDir,ClassName,GeneralReport,ExtensionCFuncListFun);
diff --git a/src/c/matrixOperations/interfaces/int_OpCc.h b/src/c/matrixOperations/interfaces/int_OpCc.h
index 48ff3907..44d30d70 100644
--- a/src/c/matrixOperations/interfaces/int_OpCc.h
+++ b/src/c/matrixOperations/interfaces/int_OpCc.h
@@ -76,9 +76,12 @@
drowcata(in1, size[0], size[1],&temp, 1, 1, out); \
}
-#define c2c0OpCcc2(in1,size,in2,out) crowcata(in1, size[0], size[1], &in2, 1, 1, out);
+#define c2c0OpCcc2(in1,size,in2,out) { floatComplex temp = in2; \
+ crowcata(in1, size[0], size[1],&temp, 1, 1, out);\
-#define z2z0OpCcz2(in1,size,in2,out) zrowcata(in1, size[0], size[1], &in2, 1, 1, out);
+#define z2z0OpCcz2(in1,size,in2,out) { doubleComplex temp =in2; \
+ zrowcata(in1, size[0], size[1],&temp, 1, 1, out);\
+ }
/* Different type */
@@ -96,13 +99,25 @@
/* Scalar-Matrix */
/* Same type */
-#define s0s2OpCcs2(in1,in2,size,out) srowcata(in1, 1, 1, in2, size[0], size[1], out);
-
-#define d0d2OpCcd2(in1,in2,size,out) drowcata(in1, 1, 1, in2, size[0], size[1], out);
-
-#define c0c2OpCcc2(in1,in2,size,out) crowcata(in1, 1, 1, in2, size[0], size[1], out);
-
-#define z0z2OpCcz2(in1,in2,size,out) zrowcata(in1, 1, 1, in2, size[0], size[1], out);
+#define s0s2OpCcs2(in1,in2,size,out) { \
+ float __tmp1 = in1 ;\
+ srowcata(&__tmp1, 1, 1, in2, size[0], size[1], out);\
+}
+
+#define d0d2OpCcd2(in1,in2,size,out) { \
+ double __tmp1 = in1 ;\
+ drowcata(&__tmp1, 1, 1, in2, size[0], size[1], out);\
+}
+
+#define c0c2OpCcc2(in1,in2,size,out) { \
+ floatComplex __tmp1 = in1 ;\
+ crowcata(&__tmp1, 1, 1, in2, size[0], size[1], out);\
+}
+
+#define z0z2OpCcz2(in1,in2,size,out) { \
+ doubleComplex __tmp1 = in1 ;\
+ zrowcata(&__tmp1, 1, 1, in2, size[0], size[1], out);\
+}
/* Different type */
#define s0c2OpCcc2(in1,in2,size,out) c0c2OpCcc2(FloatComplex(in1,0),in2,size,out)
diff --git a/src/c/matrixOperations/interfaces/int_OpRc.h b/src/c/matrixOperations/interfaces/int_OpRc.h
index dc614694..72ca0b0c 100644
--- a/src/c/matrixOperations/interfaces/int_OpRc.h
+++ b/src/c/matrixOperations/interfaces/int_OpRc.h
@@ -76,10 +76,13 @@
dcolumncata(in1, size[0], size[1],&temp, 1, 1, out); \
}
-#define c2c0OpRcc2(in1,size,in2,out) ccolumncata(in1, size[0], size[1], &in2, 1, 1, out);
-
-#define z2z0OpRcz2(in1,size,in2,out) zcolumncata(in1, size[0], size[1], &in2, 1, 1, out);
+#define c2c0OpRcc2(in1,size,in2,out) { floatComplex temp=in2; \
+ ccolumncata(in1, size[0], size[1], &temp, 1, 1, out); \
+ }
+#define z2z0OpRcz2(in1,size,in2,out) { doubleComplex temp=in2; \
+ zcolumncata(in1, size[0], size[1], &temp, 1, 1, out); \
+ }
/* Different type */
#define s2c0OpRcc2(in1,size,in2,out) sfilla((float *)out,size[0],size[1],0); \
@@ -99,13 +102,24 @@
/* Scalar-Matrix */
/* Same type */
-#define s0s2OpRcs2(in1,in2,size,out) scolumncata(in1, 1, 1, in2, size[0], size[1], out);
-
-#define d0d2OpRcd2(in1,in2,size,out) dcolumncata(in1, 1, 1, in2, size[0], size[1], out);
-
-#define c0c2OpRcc2(in1,in2,size,out) ccolumncata(in1, 1, 1, in2, size[0], size[1], out);
-
-#define z0z2OpRcz2(in1,in2,size,out) zcolumncata(in1, 1, 1, in2, size[0], size[1], out);
+#define s0s2OpRcs2(in1,in2,size,out) { \
+ float __tmp1 = in1 ;\
+ scolumncata(&__tmp1 , 1, 1, in2, size[0], size[1], out);\
+}
+#define d0d2OpRcd2(in1,in2,size,out) {\
+ double __tmp1 = in1 ;\
+ dcolumncata(&__tmp1 , 1, 1, in2, size[0], size[1], out); \
+}
+
+#define c0c2OpRcc2(in1,in2,size,out) { \
+ floatComplex __tmp1 = in1 ;\
+ ccolumncata(&__tmp1, 1, 1, in2, size[0], size[1], out);\
+}
+
+#define z0z2OpRcz2(in1,in2,size,out) { \
+ doubleComplex __tmp1 = in1 ;\
+ zcolumncata(&__tmp1, 1, 1, in2, size[0], size[1], out);\
+}
/* Different type */
#define s0c2OpRcc2(in1,in2,size,out) c0c2OpRcc2(FloatComplex(in1,0),in2,size,out)
diff --git a/tests/unit_tests/test_double_OpCc.sci b/tests/unit_tests/test_double_OpCc.sci
new file mode 100644
index 00000000..c306164c
--- /dev/null
+++ b/tests/unit_tests/test_double_OpCc.sci
@@ -0,0 +1,46 @@
+
+
+function test_double_OpCc()
+
+ a = [1 ; 2 ; 3 ; 4]; // d0d0OpCcs2
+ b = [7 ; a];// d0d2OpCcs2
+ c = [a ; 7];// d2d0OpCcs2
+ d = [a ; b];// d2d2OpCcs2
+ disp(a);
+ disp(b);
+ disp(c);
+ disp(d);
+
+ e = [1*%i ; 2*%i ; 3*%i ; 4*%i ];// z0z0OpCcz2
+ f = [7 ; e];// z0z2OpCcz2
+ g = [e ; 7];// z2z0OpCcz2
+ h = [e ; f];// z2z2OpCcz2
+
+ disp(e);
+ disp(f);
+ disp(g);
+ disp(h);
+
+
+ i = [%i ; 4.5]; // z0d0OpCcz2
+ j = [4.5 ; %i ]; // d0z0OpCcz2
+ k = [4.5 ; i ]; // d0z2OpCcz2
+ l = [i ; 4.5]; // z2d0OpCcz2
+
+ disp(i);
+ disp(j);
+ disp(k);
+ disp(l);
+
+ m = [1 ; 4.5];
+ n = [%i ; m ]; // z0d2OpCcz2
+ o = [m ; %i ]; // d0z2OpCcz2
+ p = [m ; n ]; // d2z2OpCcz2
+ q = [n ; m ]; // z2d2OpCcz2
+
+ disp(n);
+ disp(o);
+ disp(p);
+ disp(q);
+
+endfunction
diff --git a/tests/unit_tests/test_double_OpMinus.sci b/tests/unit_tests/test_double_OpMinus.sci
new file mode 100644
index 00000000..9220cce1
--- /dev/null
+++ b/tests/unit_tests/test_double_OpMinus.sci
@@ -0,0 +1,45 @@
+function test_double_OpMinus()
+ a = 1;
+ b = 2;
+ c = a - b; // d0d0OpMinusd0
+ disp(c);
+
+ d = 1 - %i; // d0z0OpMinusz0
+ e = %i - 3; // z0d0OpMinusz0
+ f = d - e; // z0z0OpMinusz0
+
+ disp(f);
+
+ g = [1 2 3; 4 5 6];
+ h = 10;
+ w = g - h; // d2d0OpMinusd2
+ j = h - g; // d0d2OpMinusd2
+
+ disp(j);
+
+ k = [9 8 7; 6 5 4; 3 2 1]
+ l = [1 2 3; 4 5 6; 7 8 9]
+ m = k - l // d2d2OpMinusd2
+
+ disp(m);
+ n = k - 2 * %i; //d2z0OpMinusz2
+ o = 3 * %i - l; //z0d2OpMinusz2
+ p = n - o; // z2z2OpMinusz2
+
+ disp(p);
+ q = [1 2 3 ; 4 5 6 ; 7 8 9]
+ r = %pi * %i;
+ s = q - r; // d2z0OpMinusz2
+ t = r - q; // z0d2OpMinusz2
+
+ disp(s);
+ disp(t);
+ u = [1 2 3] - %i * [4 5 6]
+ v = [7 8 9]
+ x = u - v; // z2d2OpMinusz2
+ y = v - u; // d2z2OpMinusz2
+
+ disp(x);
+
+ disp(y);
+endfunction
diff --git a/tests/unit_tests/test_double_OpRc.sci b/tests/unit_tests/test_double_OpRc.sci
new file mode 100644
index 00000000..8a9afd8e
--- /dev/null
+++ b/tests/unit_tests/test_double_OpRc.sci
@@ -0,0 +1,45 @@
+
+function test_double_OpRc()
+
+ a = [1 , 2 , 3 , 4]; // d0d0OpRcs2
+ b = [7 , a];// d0d2OpRcs2
+ c = [a , 7];// d2d0OpRcs2
+ d = [a , b];// d2d2OpRcs2
+ disp(a);
+ disp(b);
+ disp(c);
+ disp(d);
+
+ e = [1*%i , 2*%i , 3*%i , 4*%i ];// z0z0OpRcz2
+ f = [7 , e];// z0z2OpRcz2
+ g = [e , 7];// z2z0OpRcz2
+ h = [e , f];// z2z2OpRcz2
+
+ disp(e);
+ disp(f);
+ disp(g);
+ disp(h);
+
+
+ i = [%i , 4.5]; // z0d0OpRcz2
+ j = [4.5 , %i ]; // d0z0OpRcz2
+ k = [4.5 , i ]; // d0z2OpRcz2
+ l = [i , 4.5]; // z2d0OpRcz2
+
+ disp(i);
+ disp(j);
+ disp(k);
+ disp(l);
+
+ m = [1 , 4.5];
+ n = [%i , m ]; // z0d2OpRcz2
+ o = [m , %i ]; // d0z2OpRcz2
+ p = [m , n ]; // d2z2OpRcz2
+ q = [n , m ]; // z2d2OpRcz2
+
+ disp(n);
+ disp(o);
+ disp(p);
+ disp(q);
+
+endfunction