
$ ./diff_xdiff diff_main: Null case. WINDOW RESIZE0=>2 consuming rec ptr 0x7f966b000a00 consuming rec ptr 0x502000000250 WINDOW RESIZE2=>4 consuming rec ptr 0x7f966b000a02 WINDOW RESIZE4=>8 consuming rec ptr 0x7f966b000a04 diff_main: Equality. diff_xdiff: diff_xdiff.cpp:1047: void {anonymous}::assertEquals(const char*, std::vector<Diff>&, const std::vector<Diff>&): Assertion `std::equal(expected.begin(),expected.end(),actual.begin(),actual.end()) || std::equal(alternative.begin(),alternative.end(),actual.begin(),actual.end())' failed. Aborted
ok chatgpt and traffick boss :s isn't it weird that it consumes three pointers to the file buffer and only one pointer to the stream window buffer? that's not the right behavior! lemme get you the stack trace from that error (gdb) bt #0 __pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6, no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44 #1 0x00007ffff6a9de2f in __pthread_kill_internal (threadid=<optimized out>, signo=6) at ./nptl/pthread_kill.c:78 #2 0x00007ffff6a49d02 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26 #3 0x00007ffff6a324f0 in __GI_abort () at ./stdlib/abort.c:79 #4 0x00007ffff6a32418 in __assert_fail_base (fmt=0x7ffff6bb6ca0 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=assertion@entry=0x555555691480 "std::equal(expected.begin(),expected.end(),actual.begin(),actual.end()) || std::equal(alternative.begin(),alternative.end(),actual.begin(),actual.end())", file=file@entry=0x55555568fa40 "diff_xdiff.cpp", line=line@entry=1047, function=function@entry=0x555555691400 "void {anonymous}::assertEquals(const char*, std::vector<Diff>&, const std::vector<Diff>&)") at ./assert/assert.c:96 #5 0x00007ffff6a42612 in __assert_fail ( assertion=0x555555691480 "std::equal(expected.begin(),expected.end(),actual.begin(),actual.end()) || std::equal(alternative.begin(),alternative.end(),actual.begin(),actual.end())", file=0x55555568fa40 "diff_xdiff.cpp", line=1047, function=0x555555691400 "void {anonymous}::assertEquals(const char*, std::vector<Diff>&, const std::vector<Diff>&)") at ./assert/assert.c:105 #6 0x00005555556171e3 in (anonymous namespace)::assertEquals (desc=0x5555556922e0 "diff_main: Equality.", expected=std::vector of length 1, capacity 1 = {...}, actual=std::vector of length 3, capacity 4 = {...}) at diff_xdiff.cpp:1047 #7 0x00005555556184bd in test_diff_xdiff () at diff_xdiff.cpp:1065 #8 0x000055555561f929 in main () at diff_xdiff.cpp:1102 and now check out the variables in the failed assertion (gdb) up 6 #6 0x00005555556171e3 in (anonymous namespace)::assertEquals (desc=0x5555556922e0 "diff_main: Equality.", expected=std::vector of length 1, capacity 1 = {...}, actual=std::vector of length 3, capacity 4 = {...}) at diff_xdiff.cpp:1047 1047 assert(std::equal(expected.begin(),expected.end(),actual.begin(),actual.end()) || std::equal(alternative.begin(),alternative.end(),actual.begin(),actual.end())); (gdb) p expected $1 = std::vector of length 1, capacity 1 = {{type = EQUAL, text = "abc"}} (gdb) p equal $2 = equal # oops here i output the wrong word (gdb) p actual $3 = std::vector of length 3, capacity 4 = {{type = EQUAL, text = "a"}, {type = DELETE, text = "bc"}, {type = INSERT, text = "bc"}} actual has the wrong content. expected is what it should have. after the first character, it started making weird diffs 💁 ! maybe how things change after the first thing is related to the extra consumed pointers !