Пример #1
0
func TestFps(t *testing.T) {
	assert.False(t, theio.RegexFps1.MatchString(streams[0]))

	// --- fps ---
	assert.True(t, theio.RegexFps1.MatchString(streams[1]))
	matched := theio.RegexFps1.ReplaceAllString(streams[1],
		fmt.Sprintf("${%s}", theio.RegexFps1.SubexpNames()[2]))
	assert.Equal(t, matched, "29.97 fps,", "")

	assert.True(t, theio.RegexFps1.MatchString(streams[2]))
	matched = theio.RegexFps1.ReplaceAllString(streams[2],
		fmt.Sprintf("${%s}", theio.RegexFps1.SubexpNames()[2]))
	assert.Equal(t, matched, "23.97 fps,", "")

	// --- tbr ---
	assert.True(t, theio.RegexFps2.MatchString(streams[0]))
	matched = theio.RegexFps2.ReplaceAllString(streams[0],
		fmt.Sprintf("${%s}", theio.RegexFps2.SubexpNames()[2]))
	assert.Equal(t, matched, "25 tbr,", "")

	assert.True(t, theio.RegexFps2.MatchString(streams[2]))
	matched = theio.RegexFps2.ReplaceAllString(streams[2],
		fmt.Sprintf("${%s}", theio.RegexFps2.SubexpNames()[2]))
	assert.Equal(t, matched, "23.97 tbr,", "")

	for k, v := range mapf {
		if d, _ := theio.ParseFps(k); d != v {
			t.Errorf("tsk tsk: Fps")
		}
	}
}
Пример #2
0
func TestEmptyCheck(t *testing.T) {
	assert.True(t, util.IsEmpty("  "))
	assert.True(t, util.IsEmpty(""))
	assert.False(t, util.IsEmpty(" a "), "after trimming is length 1 is not empty")
	assert.False(t, util.IsEmpty("a"), "string of length 1 is not empty")
}