mirror of https://bitbucket.org/ausocean/av.git
Test file is complete and appears to chose that the library works.
This commit is contained in:
parent
742f92b56b
commit
94f8ffb361
|
@ -30,7 +30,6 @@ package bitrate
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
"fmt"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Some consts used over duration of testing
|
// Some consts used over duration of testing
|
||||||
|
@ -60,13 +59,18 @@ func Test1(t *testing.T) {
|
||||||
// Now let's check that the output delay feature works
|
// Now let's check that the output delay feature works
|
||||||
func Test2(t *testing.T){
|
func Test2(t *testing.T){
|
||||||
bitrateCalc = BitrateCalculator{}
|
bitrateCalc = BitrateCalculator{}
|
||||||
|
var currentBitrate int64
|
||||||
for i := 0; i < 2; i++ {
|
for i := 0; i < 2; i++ {
|
||||||
bitrateCalc.Start(bitrate2)
|
bitrateCalc.Start(bitrateDelay2)
|
||||||
time.Sleep(testTime*time.Millisecond)
|
time.Sleep(testTime*time.Millisecond)
|
||||||
currentBitrate := int64(bitrateCalc.Stop(amountOfData))
|
currentBitrate = int64(bitrateCalc.Stop(amountOfData))
|
||||||
actualBitrate := int64(amountOfData / ((testTime * time.Millisecond)/1e9))
|
|
||||||
if i == 0 && currentBitrate != 0 {
|
if i == 0 && currentBitrate != 0 {
|
||||||
|
t.Errorf("The bitrate calc did not delay outputting!")
|
||||||
|
}
|
||||||
|
time.Sleep(6000*time.Millisecond)
|
||||||
|
}
|
||||||
|
actualBitrate := int64(amountOfData / ((testTime * time.Millisecond)/1e9))
|
||||||
|
if currentBitrate != actualBitrate {
|
||||||
t.Errorf("Bitrate is wrong! Calculated: %v Actual %v", currentBitrate, actualBitrate)
|
t.Errorf("Bitrate is wrong! Calculated: %v Actual %v", currentBitrate, actualBitrate)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue