Step 107: add diff preview view
This commit is contained in:
27
editor/tests/step107_test.cpp
Normal file
27
editor/tests/step107_test.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
// Step 107 TDD Test: Diff view utilities
|
||||
//
|
||||
// Tests:
|
||||
// 1. buildLineDiff marks changed lines on both sides
|
||||
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
#include "DiffUtils.h"
|
||||
|
||||
int main() {
|
||||
int passed = 0;
|
||||
int failed = 0;
|
||||
|
||||
std::string before = "a\nb\nc";
|
||||
std::string after = "a\nx\nc\nd";
|
||||
auto diff = buildLineDiff(before, after);
|
||||
assert(diff.beforeLines.size() == 1);
|
||||
assert(diff.beforeLines[0] == 1);
|
||||
assert(diff.afterLines.size() == 2);
|
||||
assert(diff.afterLines[0] == 1);
|
||||
assert(diff.afterLines[1] == 3);
|
||||
std::cout << "Test 1 PASS: diff lines detected" << std::endl;
|
||||
++passed;
|
||||
|
||||
std::cout << "\n=== Step 107 Results: " << passed << " passed, " << failed << " failed ===" << std::endl;
|
||||
return failed > 0 ? 1 : 0;
|
||||
}
|
||||
Reference in New Issue
Block a user