You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
637 B
29 lines
637 B
2 years ago
|
package largestperimeter_test
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
|
||
|
"git.jxs.me/leetgo/largestperimeter"
|
||
|
"github.com/stretchr/testify/require"
|
||
|
)
|
||
|
|
||
|
func TestEmpty(t *testing.T) {
|
||
|
require.Equal(t, 0, largestperimeter.Triangle([]int{}))
|
||
|
}
|
||
|
|
||
|
func TestTooSmall(t *testing.T) {
|
||
|
require.Equal(t, 0, largestperimeter.Triangle([]int{1, 2}))
|
||
|
}
|
||
|
|
||
|
func TestWorking(t *testing.T) {
|
||
|
require.Equal(t, 5, largestperimeter.Triangle([]int{2, 1, 2}))
|
||
|
}
|
||
|
|
||
|
func TestInvalid(t *testing.T) {
|
||
|
require.Equal(t, 0, largestperimeter.Triangle([]int{2, 1, 1}))
|
||
|
}
|
||
|
|
||
|
func TestHundredSize(t *testing.T) {
|
||
|
require.Equal(t, 118, largestperimeter.Triangle([]int{100, 49, 50, 7, 19}))
|
||
|
}
|