Skip to content

Commit

Permalink
Test toGoStrings round trip
Browse files Browse the repository at this point in the history
  • Loading branch information
Omri Treidel authored and deadprogram committed Oct 21, 2020
1 parent 390b7d7 commit f7de642
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
14 changes: 14 additions & 0 deletions core_test.go
Expand Up @@ -2288,3 +2288,17 @@ func TestColRowRange(t *testing.T) {
t.Errorf("TestColRowRange incorrect submatCols count: %v\n", submatCols.Cols())
}
}

func Test_toGoStrings(t *testing.T) {
goStrings := []string{"foo", "bar"}
cStrings := toCStrings(goStrings)
result := toGoStrings(cStrings)
if len(goStrings) != len(result) {
t.Errorf("TesttoGoStrings failed: length of converted string is not equal to original \n")
}
for i, s := range goStrings {
if s != result[i] {
t.Errorf("TesttoGoStrings failed: strings are not equal. expected=%s, actusal=%s", s, result[i])
}
}
}
7 changes: 7 additions & 0 deletions objdetect_test.go
Expand Up @@ -191,6 +191,13 @@ func TestQRCodeDetector(t *testing.T) {
t.Errorf("Error in TestQRCodeDetector Multi test: decoded straight QR code=%s, decoded[%d] =%s", tmpDecoded, i, s)
}
}

emptyMat := NewMatWithSize(100, 200, MatTypeCV8UC3)
success = detector.DetectAndDecodeMulti(emptyMat, &decoded, &multiBox2, &qrCodes)
if success {
t.Errorf("Error in TestQRCodeDetector Multi test: empty Mat returned sucess=true")
}
emptyMat.Close()
}

func padQr(qr *Mat) Mat {
Expand Down

0 comments on commit f7de642

Please sign in to comment.