Merge remote-tracking branches 'sebastian/consdiff_add' and 'sebastian/consdiff_newline'

This commit is contained in:
Nick Mathewson
2017-04-18 21:31:53 -04:00
2 changed files with 12 additions and 1 deletions
+1 -1
View File
@@ -671,7 +671,7 @@ gen_ed_diff(const smartlist_t *cons1, const smartlist_t *cons2,
*/
i1=len1-1, i2=len2-1;
char buf[128];
while (i1 > 0 || i2 > 0) {
while (i1 >= 0 || i2 >= 0) {
int start1x, start2x, end1, end2, added, deleted;
+11
View File
@@ -622,6 +622,17 @@ test_consdiff_gen_ed_diff(void *arg)
tt_str_eq_line(".", smartlist_get(diff, 5));
tt_str_eq_line("2d", smartlist_get(diff, 6));
smartlist_clear(cons1);
smartlist_clear(cons2);
consensus_split_lines(cons1, "B\n", area);
consensus_split_lines(cons2, "A\nB\n", area);
diff = gen_ed_diff(cons1, cons2, area);
tt_ptr_op(NULL, OP_NE, diff);
tt_int_op(3, OP_EQ, smartlist_len(diff));
tt_str_eq_line("0a", smartlist_get(diff, 0));
tt_str_eq_line("A", smartlist_get(diff, 1));
tt_str_eq_line(".", smartlist_get(diff, 2));
/* TODO: small real use-cases, i.e. consensuses. */
done: