1
0

main_test.go 823 B

12345678910111213141516171819202122232425262728
  1. package main
  2. import (
  3. "path/filepath"
  4. "testing"
  5. )
  6. const testdata = "../../testdata"
  7. func TestCompare(t *testing.T) {
  8. t1 := filepath.Join(testdata, "accepted", "MpckitT1.xpj")
  9. t2 := filepath.Join(testdata, "accepted", "MpckitT2.xpj")
  10. t3 := filepath.Join(testdata, "accepted", "MpckitT3.xpj")
  11. if n, err := compare(t1, t1); err != nil || n != 0 {
  12. t.Errorf("T1 vs T1: %d, %v", n, err)
  13. }
  14. // T2 has the same .xpj as T1 but stripped WAVs: two data files differ.
  15. if n, err := compare(t1, t2); err != nil || n != 2 {
  16. t.Errorf("T1 vs T2: %d differences, want 2 (%v)", n, err)
  17. }
  18. // T3 shares one pool entry: many differences.
  19. if n, err := compare(t1, t3); err != nil || n < 3 {
  20. t.Errorf("T1 vs T3: %d, %v", n, err)
  21. }
  22. if _, err := compare(t1, "missing.xpj"); err == nil {
  23. t.Error("missing file accepted")
  24. }
  25. }