This is an automated email from the ASF dual-hosted git repository.

ssiddiqi pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/systemds.git


The following commit(s) were added to refs/heads/main by this push:
     new 2603723  [MINOR] Fixing failing tests in valueSwaps
2603723 is described below

commit 260372349d7bf7780d99abff6bda28cddf807d45
Author: Shafaq Siddiqi <shafaq.sidd...@tugraz.at>
AuthorDate: Wed Nov 10 12:58:26 2021 +0100

    [MINOR] Fixing failing tests in valueSwaps
---
 .../sysds/test/functions/frame/FrameValueSwapTest.java       | 12 +++++-------
 src/test/scripts/functions/frame/valueSwaps.dml              | 10 ++++++----
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git 
a/src/test/java/org/apache/sysds/test/functions/frame/FrameValueSwapTest.java 
b/src/test/java/org/apache/sysds/test/functions/frame/FrameValueSwapTest.java
index fee775c..13819ac 100644
--- 
a/src/test/java/org/apache/sysds/test/functions/frame/FrameValueSwapTest.java
+++ 
b/src/test/java/org/apache/sysds/test/functions/frame/FrameValueSwapTest.java
@@ -26,7 +26,6 @@ import org.apache.sysds.test.AutomatedTestBase;
 import org.apache.sysds.test.TestConfiguration;
 import org.apache.sysds.test.TestUtils;
 import org.junit.Assert;
-import org.junit.Ignore;
 import org.junit.Test;
 
 public class FrameValueSwapTest extends AutomatedTestBase
@@ -53,14 +52,12 @@ public class FrameValueSwapTest extends AutomatedTestBase
                addTestConfiguration(TEST_NAME, new 
TestConfiguration(TEST_CLASS_DIR, TEST_NAME, new String[] {"B"}));
        }
        //
-       @Ignore
+
        @Test
        public void testSwapValueTestCP() {
                runValueSwapTest(ExecType.CP);
        }
 
-       // TODO fix frame comparisons in spark context
-       @Ignore
        @Test
        public void testSwapValueTestSP() {
                runValueSwapTest(ExecType.SPARK);
@@ -68,16 +65,17 @@ public class FrameValueSwapTest extends AutomatedTestBase
 
        private void runValueSwapTest(ExecType et)
        {
+               setOutputBuffering(true);
                Types.ExecMode platformOld = setExecMode(et);
 
                try {
                        getAndLoadTestConfiguration(TEST_NAME);
                        String HOME = SCRIPT_DIR + TEST_DIR;
                        fullDMLScriptName = HOME + TEST_NAME + ".dml";
-                       programArgs = new String[] {"-args", INPUT, 
output("B")};
+                       programArgs = new String[] {"-args", INPUT};
                        runTest(true, false, null, -1);
-                       boolean retCondition = 
HDFSTool.readBooleanFromHDFSFile(output("B"));
-                       Assert.assertEquals(true, retCondition);
+                       String out = runTest(null).toString();
+                       Assert.assertTrue(out.contains("TRUE"));
 
                }
                catch (Exception ex) {
diff --git a/src/test/scripts/functions/frame/valueSwaps.dml 
b/src/test/scripts/functions/frame/valueSwaps.dml
index 68e948f..07ed37c 100644
--- a/src/test/scripts/functions/frame/valueSwaps.dml
+++ b/src/test/scripts/functions/frame/valueSwaps.dml
@@ -21,9 +21,9 @@
 
 # read the inputs
 F = read($1, data_type="frame", format="csv", header=TRUE, naStrings= ["NA", 
"null","  ","NaN", "nan", "", "?", "99999"]);
-
+F = F[1:50]
 d = detectSchema(F)
-idx = sample(20, 10)  
+idx = sample(nrow(F), 10)  
 F1 = F
 # # swap values
 for(i in 1:10)
@@ -36,6 +36,8 @@ for(i in 1:10)
 
 R = valueSwap(F1, d)
 f1 = as.matrix(F == R)
+print("f1: "+toString(f1))
+print("sum of f1: "+sum(f1))
+print("dims: "+(ncol(F) * nrow(F)))
 result = ((ncol(F) * nrow(F)) == sum(f1))
-
-write(result, $2)
\ No newline at end of file
+print(result)
\ No newline at end of file

Reply via email to