[grisbi-cvs] grisbi/src gsb_real_cunit.c,1.5,1.6

Mickaƫl Remars mykeul at users.sourceforge.net
Wed May 20 21:03:09 CEST 2009


Update of /cvsroot/grisbi/grisbi/src
In directory ddv4jf1.ch3.sourceforge.com:/tmp/cvs-serv15466/src

Modified Files:
	gsb_real_cunit.c 
Log Message:
Added a few more tests on gsb_real_add(), most of them fail with current version of the function

Index: gsb_real_cunit.c
===================================================================
RCS file: /cvsroot/grisbi/grisbi/src/gsb_real_cunit.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- gsb_real_cunit.c	19 May 2009 18:24:58 -0000	1.5
+++ gsb_real_cunit.c	20 May 2009 19:03:07 -0000	1.6
@@ -191,6 +191,46 @@
     gsb_real r = gsb_real_add(a, b);
     CU_ASSERT_EQUAL(41415, r.mantissa);
     CU_ASSERT_EQUAL(4, r.exponent);
+    
+    a.mantissa = 0x7FFFFFFE;
+    a.exponent = 0;
+    b.mantissa = 1;
+    b.exponent = 0;
+    r = gsb_real_add(a, b);
+    CU_ASSERT_EQUAL(0x7FFFFFFF, r.mantissa);
+    CU_ASSERT_EQUAL(0, r.exponent);
+    
+    a.mantissa = 0x7FFFFFFF;
+    a.exponent = 0;
+    b.mantissa = 2;
+    b.exponent = 0;
+    r = gsb_real_add(a, b);
+    CU_ASSERT_EQUAL(0x80000000, r.mantissa);
+    CU_ASSERT_EQUAL(0, r.exponent);
+    
+    a.mantissa = 0x80000001;
+    a.exponent = 0;
+    b.mantissa = -2;
+    b.exponent = 0;
+    r = gsb_real_add(a, b);
+    CU_ASSERT_EQUAL(0x80000000, r.mantissa);
+    CU_ASSERT_EQUAL(0, r.exponent);
+
+    a.mantissa = 0x80000000;
+    a.exponent = 0;
+    b.mantissa = 100;
+    b.exponent = 0;
+    r = gsb_real_add(a, b);
+    CU_ASSERT_EQUAL(0x80000000, r.mantissa);
+    CU_ASSERT_EQUAL(0, r.exponent);
+
+    a.mantissa = 100;
+    a.exponent = 0;
+    b.mantissa = 0x80000000;
+    b.exponent = 0;
+    r = gsb_real_add(a, b);
+    CU_ASSERT_EQUAL(0x80000000, r.mantissa);
+    CU_ASSERT_EQUAL(0, r.exponent);
 }
 
 CU_pSuite gsb_real_cunit_create_suite ( void )



More information about the cvs mailing list