(t *testing.T)
| 451 | } |
| 452 | |
| 453 | func TestSharedPrefixLen(t *testing.T) { |
| 454 | if sharedPrefixLen(nil, []byte("hi")) != 0 { |
| 455 | t.Errorf("not matched") |
| 456 | } |
| 457 | if sharedPrefixLen([]byte("hi"), nil) != 0 { |
| 458 | t.Errorf("not matched") |
| 459 | } |
| 460 | if sharedPrefixLen(nil, nil) != 0 { |
| 461 | t.Errorf("not matched") |
| 462 | } |
| 463 | |
| 464 | tests := []struct { |
| 465 | a, b string |
| 466 | exp int |
| 467 | }{ |
| 468 | {"x", "", 0}, |
| 469 | {"", "x", 0}, |
| 470 | {"x", "x", 1}, |
| 471 | {"x", "xy", 1}, |
| 472 | {"xy", "x", 1}, |
| 473 | {"x", "xx", 1}, |
| 474 | {"xx", "x", 1}, |
| 475 | {"xx", "xx", 2}, |
| 476 | {"xx", "xxy", 2}, |
| 477 | {"xxy", "xx", 2}, |
| 478 | } |
| 479 | |
| 480 | for _, test := range tests { |
| 481 | if sharedPrefixLen([]byte(test.a), []byte(test.b)) != test.exp { |
| 482 | t.Errorf("didn't match on test: %#v", test) |
| 483 | } |
| 484 | } |
| 485 | } |
| 486 | |
| 487 | func TestIteratorSingleDone(t *testing.T) { |
| 488 | tmpDir, _ := ioutil.TempDir("", "mossStore") |
nothing calls this directly
no test coverage detected
searching dependent graphs…