[Libreoffice-commits] .: sc/qa

Kohei Yoshida kohei at kemper.freedesktop.org
Tue Nov 1 14:02:45 PDT 2011


 sc/qa/unit/ucalc.cxx |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

New commits:
commit 2f46c82072470599f1fe92dc2235873d6a5ef4ac
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Tue Nov 1 17:02:09 2011 -0400

    New unit test to test AND and OR evaluations of matrix objects.
    
    This is in response to fdo#40967.

diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 6c1ab75..a19e300 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -640,6 +640,24 @@ void Test::testMatrix()
                                pMat->And() && pMat->Or());
     }
 
+    // Test the AND and OR evaluations.
+    for (int i = 0; i < 2; ++i)
+    {
+        pMat = new ScMatrix(2, 2, eDT[i]);
+
+        // Only some of the elements are non-zero.
+        pMat->PutBoolean(true, 0, 0);
+        pMat->PutDouble(1.0, 1, 1);
+        CPPUNIT_ASSERT_MESSAGE("incorrect OR result", pMat->Or());
+        CPPUNIT_ASSERT_MESSAGE("incorrect AND result", !pMat->And());
+
+        // All of the elements are non-zero.
+        pMat->PutBoolean(true, 0, 1);
+        pMat->PutDouble(2.3, 1, 0);
+        CPPUNIT_ASSERT_MESSAGE("incorrect OR result", pMat->Or());
+        CPPUNIT_ASSERT_MESSAGE("incorrect AND result", pMat->And());
+    }
+
     // Now test the emtpy matrix types.
     eDT[0] = ScMatrix::FILLED_EMPTY;
     eDT[1] = ScMatrix::SPARSE_EMPTY;


More information about the Libreoffice-commits mailing list