1 // RUN: %clang_cc1 -E %s > %t.src.cpp
2 // RUN: %clang_cc1 -E %s > %t.dst.cpp -DDEST
3 // RUN: clang-diff -dump-matches -s=10 %t.src.cpp %t.dst.cpp -- | FileCheck %s
5 // Test the behaviour of the matching according to the optimal tree edit
6 // distance, implemented with Zhang and Shasha's algorithm.
7 // Just for testing we use a tiny value of 10 for maxsize. Subtrees bigger than
8 // this size will not be processed by the optimal algorithm.
12 void f1() { {;} {{;}} }
14 void f2() { {;} {{;;;;;}} }
16 void f3() { {;} {{;;;;;;}} }
21 // Jaccard similarity = 3 / (5 + 4 - 3) = 3 / 6 >= 0.5
22 // The optimal matching algorithm should move the ; into the outer block
23 // CHECK: Match CompoundStmt(2) to CompoundStmt(2)
24 // CHECK-NOT: Match CompoundStmt(3)
25 // CHECK-NEXT: Match NullStmt(4) to NullStmt(3)
30 // Jaccard similarity = 7 / (10 + 10 - 7) >= 0.5
31 // As none of the subtrees is bigger than 10 nodes, the optimal algorithm
33 // CHECK: Match NullStmt(11) to NullStmt(9)
38 // Jaccard similarity = 8 / (11 + 11 - 8) >= 0.5
39 // As the subtrees are bigger than 10 nodes, the optimal algorithm will not
41 // CHECK: Delete NullStmt(22)