mirror of https://bitbucket.org/ausocean/av.git
rtmp: make tests pass
This commit is contained in:
parent
c494da9a1d
commit
40785e7454
|
@ -81,7 +81,7 @@ func TestMemset(t *testing.T) {
|
|||
if i > setNum-1 {
|
||||
testVal = byte(0)
|
||||
}
|
||||
if *indxBytePtr(mem, i) != testVal {
|
||||
if (*[_Gi]byte)(unsafe.Pointer(mem))[i] != testVal {
|
||||
t.Errorf("mem doesn't match expected values at: %v", i)
|
||||
}
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ func TestGoStrToCStr(t *testing.T) {
|
|||
testData := []byte{'s', 't', 'r', 'i', 'n', 'g', '\000'}
|
||||
|
||||
for i := 0; i < len(goStr); i++ {
|
||||
val := *indxBytePtr(unsafe.Pointer(bStr), i)
|
||||
val := (*[_Gi]byte)(unsafe.Pointer(bStr))[i]
|
||||
testVal := testData[i]
|
||||
if val != testVal {
|
||||
t.Errorf("Wanted: %v, but got: %v", testVal, val)
|
||||
|
@ -111,7 +111,7 @@ func TestStrdup(t *testing.T) {
|
|||
newStr := strdup(bStr)
|
||||
|
||||
for i := 0; i < len(goStr); i++ {
|
||||
val := *indxBytePtr(unsafe.Pointer(newStr), i)
|
||||
val := (*[_Gi]byte)(unsafe.Pointer(newStr))[i]
|
||||
testVal := testData[i]
|
||||
if val != testVal {
|
||||
t.Errorf("Wanted: %v, but got: %v", testVal, val)
|
||||
|
@ -191,12 +191,3 @@ func TestDecPtr(t *testing.T) {
|
|||
t.Errorf(errMsg, valueInt64, int64Arr[inc])
|
||||
}
|
||||
}
|
||||
|
||||
func TestIndxBytePtr(t *testing.T) {
|
||||
// Test how it deals with bytes
|
||||
bytePtr := unsafe.Pointer(&byteArr[arrStart])
|
||||
valueByte := indxBytePtr(bytePtr, inc)
|
||||
if *valueByte != byteArr[inc] {
|
||||
t.Errorf(errMsg, valueByte, byteArr[inc])
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue