Exemplo n.º 1
0
 public function checkDiff($e1, $e2, $verbose = null)
 {
     if ($verbose === null) {
         $verbose = false;
     }
     $table1 = harness_Native::table($e1);
     $table2 = harness_Native::table($e2);
     $data_diff = new _hx_array(array());
     $table_diff = harness_Native::table($data_diff);
     $flags = new coopy_CompareFlags();
     $alignment = coopy_Coopy::compareTables($table1, $table2, $flags)->align();
     if ($verbose) {
         haxe_Log::trace("Alignment: " . Std::string($alignment), _hx_anonymous(array("fileName" => "SmallTableTest.hx", "lineNumber" => 18, "className" => "harness.SmallTableTest", "methodName" => "checkDiff")));
     }
     $highlighter = new coopy_TableDiff($alignment, $flags);
     $highlighter->hilite($table_diff);
     if ($verbose) {
         haxe_Log::trace("Diff: " . Std::string($table_diff), _hx_anonymous(array("fileName" => "SmallTableTest.hx", "lineNumber" => 21, "className" => "harness.SmallTableTest", "methodName" => "checkDiff")));
     }
     $o = coopy_Coopy::diff($table1, $table2, null);
     $this->assertTrue(coopy_SimpleTable::tableIsSimilar($table_diff, $o), _hx_anonymous(array("fileName" => "SmallTableTest.hx", "lineNumber" => 25, "className" => "harness.SmallTableTest", "methodName" => "checkDiff")));
     $table3 = $table1->hclone();
     $patcher = new coopy_HighlightPatch($table3, $table_diff, null);
     $patcher->apply();
     if ($verbose) {
         haxe_Log::trace("Desired " . _hx_string_rec($table2->get_height(), "") . "x" . _hx_string_rec($table2->get_width(), "") . ": " . Std::string($table2), _hx_anonymous(array("fileName" => "SmallTableTest.hx", "lineNumber" => 30, "className" => "harness.SmallTableTest", "methodName" => "checkDiff")));
     }
     if ($verbose) {
         haxe_Log::trace("Got " . _hx_string_rec($table3->get_height(), "") . "x" . _hx_string_rec($table3->get_width(), "") . ": " . Std::string($table3), _hx_anonymous(array("fileName" => "SmallTableTest.hx", "lineNumber" => 31, "className" => "harness.SmallTableTest", "methodName" => "checkDiff")));
     }
     if ($verbose) {
         haxe_Log::trace("Base " . _hx_string_rec($table1->get_height(), "") . "x" . _hx_string_rec($table1->get_width(), "") . ": " . Std::string($table1), _hx_anonymous(array("fileName" => "SmallTableTest.hx", "lineNumber" => 32, "className" => "harness.SmallTableTest", "methodName" => "checkDiff")));
     }
     $this->assertTrue(coopy_SimpleTable::tableIsSimilar($table3, $table2), _hx_anonymous(array("fileName" => "SmallTableTest.hx", "lineNumber" => 33, "className" => "harness.SmallTableTest", "methodName" => "checkDiff")));
     return $table_diff;
 }
Exemplo n.º 2
0
 public function testThreeWay()
 {
     $flags = new coopy_CompareFlags();
     $table1 = harness_Native::table($this->data1);
     $table2 = harness_Native::table($this->data2);
     $table3 = harness_Native::table($this->data3);
     $table4 = harness_Native::table($this->data4);
     $flags->parent = $table1;
     $out = coopy_Coopy::diff($table2, $table3, $flags);
     $table2b = $table2->hclone();
     coopy_Coopy::patch($table2b, $out, null);
     $this->assertTrue(coopy_SimpleTable::tableIsSimilar($table4, $table2b), _hx_anonymous(array("fileName" => "BasicTest.hx", "lineNumber" => 130, "className" => "harness.BasicTest", "methodName" => "testThreeWay")));
 }