cp437tree/main_test.go

76 lines
1.1 KiB
Go
Raw Normal View History

2021-07-09 20:26:12 +00:00
package cp437tree
import (
"testing"
2021-07-09 20:40:31 +00:00
"github.com/stretchr/testify/assert"
2021-07-09 20:26:12 +00:00
)
func Test_Main(t *testing.T) {
tree := Tree{
Text: "1",
Children: []Tree{
{
Text: "2",
Children: []Tree{
{
Text: "3",
},
{
Text: "4",
},
{
Text: "5",
},
{
Text: "6",
},
{
Text: "7",
Children: []Tree{
{
Text: "8",
},
},
},
},
},
{
Text: "9",
},
{
Text: "10",
Children: []Tree{
{
Text: "11",
Children: []Tree{
{
Text: "12",
Children: []Tree{
{
Text: "13",
Children: []Tree{
{
Text: "14",
Children: []Tree{
{
Text: "15",
},
},
},
},
},
},
},
},
},
},
},
},
}
2021-07-09 20:40:31 +00:00
assert.Equal(t, tree.Text, "1")
assert.Equal(t, tree.Children[0].Text, "2")
assert.Equal(t, tree.Children[2].Children[0].Children[0].Children[0].Children[0].Children[0].Text, "15")
2021-07-09 20:26:12 +00:00
}