mirror of
https://github.com/httprunner/httprunner.git
synced 2026-07-13 00:11:28 +08:00
docs: add examples for API
This commit is contained in:
31
examples/worldcup/main_test.go
Normal file
31
examples/worldcup/main_test.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestConvertTimeToSeconds(t *testing.T) {
|
||||
testData := []struct {
|
||||
timeStr string
|
||||
seconds int
|
||||
}{
|
||||
{"00:00", 0},
|
||||
{"00:01", 1},
|
||||
{"01:00", 60},
|
||||
{"01:01", 61},
|
||||
{"00:01:02", 62},
|
||||
{"01:02:03", 3723},
|
||||
}
|
||||
|
||||
for _, td := range testData {
|
||||
seconds, err := convertTimeToSeconds(td.timeStr)
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, td.seconds, seconds)
|
||||
}
|
||||
}
|
||||
|
||||
func TestMain(t *testing.T) {
|
||||
main()
|
||||
}
|
||||
Reference in New Issue
Block a user