code-google-com / google-diff-match-patch

Automatically exported from code.google.com/p/google-diff-match-patch
Apache License 2.0
0 stars 0 forks source link

C++ test fails intermittently #61

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
When building the C++ module and running the accompanying test, I get different 
results between invocations. About 50% of the time the test completes 
successfully. The rest of the times, I get this error:

diff_bisect: Timeout. FAIL
Expected: (Diff(DELETE,"cat"), Diff(INSERT,"map"))
Actual: (Diff(DELETE,"c"), Diff(INSERT,"m"), Diff(EQUAL,"a"), Diff(DELETE,"t"), 
Diff(INSERT,"p"))
Test failed: diff_bisect: Timeout.
Total time: 6 ms
Done.

I see this both with the 20111117 release and trunk.

Original issue reported on code.google.com by kstuts...@gmail.com on 25 Dec 2011 at 7:20

GoogleCodeExporter commented 9 years ago
Thanks for reporting this.  I see the issue: your computer is faster than mine. 
 Don't worry about that test, feel free to comment it out.  The DMP library 
itself is correct.

In most languages the clock() function returns some form of the current 
date/time, so checking for clock() > 0 bails instantly.  But in C++ clock() 
represents the number of ticks since the program started.  So if you have a 
particularly fast computer, clock() could return 0.  This represents a flaw in 
the unit test only, I should change it to give a timeout of -1 instead.

Original comment by neil.fra...@gmail.com on 25 Dec 2011 at 8:18

GoogleCodeExporter commented 9 years ago
Good to know. Thanks for looking into it so quickly.

Original comment by kstuts...@gmail.com on 25 Dec 2011 at 10:35