Test with the tree with up to 2000 vertices.
(t *testing.T)
| 231 | |
| 232 | // Test with the tree with up to 2000 vertices. |
| 233 | func TestLCAWithLargeTree(t *testing.T) { |
| 234 | const MAXTEST int = 20 |
| 235 | |
| 236 | for test := 1; test <= MAXTEST; test++ { |
| 237 | tree := generateTree() |
| 238 | LowestCommonAncestor(tree) |
| 239 | |
| 240 | queries := generateQuery(tree) |
| 241 | |
| 242 | for qi, query := range queries { |
| 243 | actual := tree.GetLCA(query.u, query.v) |
| 244 | expected := query.expected |
| 245 | if actual != expected { |
| 246 | t.Errorf("\nTest #%d:\nQuery #%d: u = %d, v = %d\nExpected %d, but actual %d", test, qi, query.u, query.v, expected, actual) |
| 247 | } |
| 248 | } |
| 249 | } |
| 250 | } |
nothing calls this directly
no test coverage detected