Browse Source

Fix list & tree exercises

pull/625/head
4 years ago
parent
commit
1d747c504a
  1. 2
      go/tests/func/btreeapplybylevel_test/main.go
  2. 2
      go/tests/func/btreeapplyinorder_test/main.go
  3. 2
      go/tests/func/btreeapplypostorder_test/main.go
  4. 2
      go/tests/func/btreeapplypreorder_test/main.go
  5. 5
      go/tests/func/btreedeletenode_test/main.go
  6. 5
      go/tests/func/btreeinsertdata_test/main.go
  7. 5
      go/tests/func/btreeisbinary_test/main.go
  8. 5
      go/tests/func/btreelevelcount_test/main.go
  9. 5
      go/tests/func/btreemax_test/main.go
  10. 5
      go/tests/func/btreemin_test/main.go
  11. 5
      go/tests/func/btreesearchitem_test/main.go
  12. 5
      go/tests/func/btreetransplant_test/main.go
  13. 24
      go/tests/func/correct/challenge.go
  14. 5
      go/tests/func/listat_test/main.go
  15. 5
      go/tests/func/listclear_test/main.go
  16. 5
      go/tests/func/listfind_test/main.go
  17. 5
      go/tests/func/listforeach_test/main.go
  18. 5
      go/tests/func/listforeachif_test/main.go
  19. 5
      go/tests/func/listlast_test/main.go
  20. 5
      go/tests/func/listmerge_test/main.go
  21. 5
      go/tests/func/listpushback_test/main.go
  22. 5
      go/tests/func/listpushfront_test/main.go
  23. 5
      go/tests/func/listremoveif_test/main.go
  24. 5
      go/tests/func/listreverse_test/main.go
  25. 5
      go/tests/func/listsize_test/main.go
  26. 5
      go/tests/func/listsort_test/main.go
  27. 5
      go/tests/func/sortedlistmerge_test/main.go
  28. 5
      go/tests/func/sortlistinsert_test/main.go

2
go/tests/func/btreeapplybylevel_test/main.go

@ -5,7 +5,7 @@ import (
student "student"
"./correct"
"func/correct"
)
func main() {

2
go/tests/func/btreeapplyinorder_test/main.go

@ -5,7 +5,7 @@ import (
student "student"
"./correct"
"func/correct"
)
func main() {

2
go/tests/func/btreeapplypostorder_test/main.go

@ -5,7 +5,7 @@ import (
student "student"
"./correct"
"func/correct"
)
func main() {

2
go/tests/func/btreeapplypreorder_test/main.go

@ -5,7 +5,7 @@ import (
student "student"
"./correct"
"func/correct"
)
func main() {

5
go/tests/func/btreedeletenode_test/main.go

@ -3,8 +3,9 @@ package main
import (
student "student"
"./correct"
"github.com/01-edu/public/go/lib"
"func/correct"
"lib"
)
func parentListDelete(root *student.TreeNode) string {

5
go/tests/func/btreeinsertdata_test/main.go

@ -3,8 +3,9 @@ package main
import (
student "student"
"./correct"
"github.com/01-edu/public/go/lib"
"func/correct"
"lib"
)
func parentListInsert(root *student.TreeNode) string {

5
go/tests/func/btreeisbinary_test/main.go

@ -5,8 +5,9 @@ import (
student "student"
"./correct"
"github.com/01-edu/public/go/lib"
"func/correct"
"lib"
)
func BTreeMinStu(root *student.TreeNode) *student.TreeNode {

5
go/tests/func/btreelevelcount_test/main.go

@ -5,8 +5,9 @@ import (
student "student"
"./correct"
"github.com/01-edu/public/go/lib"
"func/correct"
"lib"
)
func errorMessage_level(fn interface{}, root, a *correct.TreeNode, b *student.TreeNode) {

5
go/tests/func/btreemax_test/main.go

@ -5,8 +5,9 @@ import (
student "student"
"./correct"
"github.com/01-edu/public/go/lib"
"func/correct"
"lib"
)
func errorMessage_max(fn interface{}, root, a *correct.TreeNode, b *student.TreeNode) {

5
go/tests/func/btreemin_test/main.go

@ -5,8 +5,9 @@ import (
student "student"
"./correct"
"github.com/01-edu/public/go/lib"
"func/correct"
"lib"
)
func errorMessage_min(fn interface{}, root, a *correct.TreeNode, b *student.TreeNode) {

5
go/tests/func/btreesearchitem_test/main.go

@ -5,8 +5,9 @@ import (
student "student"
"./correct"
"github.com/01-edu/public/go/lib"
"func/correct"
"lib"
)
func errorMessage_search(fn interface{}, root, a *correct.TreeNode, b *student.TreeNode,

5
go/tests/func/btreetransplant_test/main.go

@ -5,8 +5,9 @@ import (
student "student"
"./correct"
"github.com/01-edu/public/go/lib"
"func/correct"
"lib"
)
func parentListTransp(root *student.TreeNode) string {

24
go/tests/func/correct/challenge.go

@ -6,7 +6,7 @@ import (
"strconv"
"strings"
"github.com/01-edu/z01"
"lib"
)
func FormatTree(root *TreeNode) string {
@ -96,15 +96,15 @@ func ChallengeTree(
args2 = append(args2, v)
}
}
st1 := z01.Monitor(fn1, args1)
st2 := z01.Monitor(fn2, args2)
st1 := lib.Monitor(fn1, args1)
st2 := lib.Monitor(fn2, args2)
if st1.Stdout != st2.Stdout {
z01.Fatalf("%s(\n%s)\n prints %s instead of %s\n",
lib.Fatalf("%s(\n%s)\n prints %s instead of %s\n",
name,
FormatTree(arg1),
z01.Format(st2.Stdout),
z01.Format(st1.Stdout),
lib.Format(st2.Stdout),
lib.Format(st1.Stdout),
)
}
}
@ -137,10 +137,10 @@ func ListToString(n *NodeL) string {
}
func ConvertIntToInterface(t []int) []interface{} {
RandLen := z01.RandIntBetween(0, len(t))
RandLen := lib.RandIntBetween(0, len(t))
s := make([]interface{}, RandLen)
for j := 0; j < RandLen; j++ {
for i := 0; i < z01.RandIntBetween(1, len(t)); i++ {
for i := 0; i < lib.RandIntBetween(1, len(t)); i++ {
s[j] = t[i]
}
}
@ -148,10 +148,10 @@ func ConvertIntToInterface(t []int) []interface{} {
}
func ConvertIntToStringface(t []string) []interface{} {
RandLen := z01.RandIntBetween(0, len(t))
RandLen := lib.RandIntBetween(0, len(t))
s := make([]interface{}, RandLen)
for j := 0; j < RandLen; j++ {
for i := 0; i < z01.RandIntBetween(1, len(t)); i++ {
for i := 0; i < lib.RandIntBetween(1, len(t)); i++ {
s[j] = t[i]
}
}
@ -170,13 +170,13 @@ func ElementsToTest(table []NodeTest) []NodeTest {
)
for i := 0; i < 3; i++ {
val := NodeTest{
Data: ConvertIntToInterface(z01.MultRandInt()),
Data: ConvertIntToInterface(lib.MultRandInt()),
}
table = append(table, val)
}
for i := 0; i < 3; i++ {
val := NodeTest{
Data: ConvertIntToStringface(z01.MultRandWords()),
Data: ConvertIntToStringface(lib.MultRandWords()),
}
table = append(table, val)
}

5
go/tests/func/listat_test/main.go

@ -3,8 +3,9 @@ package main
import (
student "student"
"./correct"
"github.com/01-edu/public/go/lib"
"func/correct"
"lib"
)
type Node5 = student.NodeL

5
go/tests/func/listclear_test/main.go

@ -5,8 +5,9 @@ import (
student "student"
"./correct"
"github.com/01-edu/public/go/lib"
"func/correct"
"lib"
)
type Node4 = student.NodeL

5
go/tests/func/listfind_test/main.go

@ -3,8 +3,9 @@ package main
import (
student "student"
"./correct"
"github.com/01-edu/public/go/lib"
"func/correct"
"lib"
)
type Node9 = student.NodeL

5
go/tests/func/listforeach_test/main.go

@ -5,8 +5,9 @@ import (
student "student"
"./correct"
"github.com/01-edu/public/go/lib"
"func/correct"
"lib"
)
type Node7 = student.NodeL

5
go/tests/func/listforeachif_test/main.go

@ -5,8 +5,9 @@ import (
student "student"
"./correct"
"github.com/01-edu/public/go/lib"
"func/correct"
"lib"
)
type Node8 = student.NodeL

5
go/tests/func/listlast_test/main.go

@ -5,8 +5,9 @@ import (
student "student"
"./correct"
"github.com/01-edu/public/go/lib"
"func/correct"
"lib"
)
type Node3 = student.NodeL

5
go/tests/func/listmerge_test/main.go

@ -5,8 +5,9 @@ import (
student "student"
"./correct"
"github.com/01-edu/public/go/lib"
"func/correct"
"lib"
)
type Node11 = student.NodeL

5
go/tests/func/listpushback_test/main.go

@ -5,8 +5,9 @@ import (
student "student"
"./correct"
"github.com/01-edu/public/go/lib"
"func/correct"
"lib"
)
type ListS = correct.List

5
go/tests/func/listpushfront_test/main.go

@ -5,8 +5,9 @@ import (
student "student"
"./correct"
"github.com/01-edu/public/go/lib"
"func/correct"
"lib"
)
type ListSa = correct.List

5
go/tests/func/listremoveif_test/main.go

@ -5,8 +5,9 @@ import (
student "student"
"./correct"
"github.com/01-edu/public/go/lib"
"func/correct"
"lib"
)
type Node10 = student.NodeL

5
go/tests/func/listreverse_test/main.go

@ -5,8 +5,9 @@ import (
student "student"
"./correct"
"github.com/01-edu/public/go/lib"
"func/correct"
"lib"
)
type Node6 = student.NodeL

5
go/tests/func/listsize_test/main.go

@ -3,8 +3,9 @@ package main
import (
student "student"
"./correct"
"github.com/01-edu/public/go/lib"
"func/correct"
"lib"
)
type Node2 = student.NodeL

5
go/tests/func/listsort_test/main.go

@ -5,8 +5,9 @@ import (
student "student"
"./correct"
"github.com/01-edu/public/go/lib"
"func/correct"
"lib"
)
type NodeI12 = student.NodeI

5
go/tests/func/sortedlistmerge_test/main.go

@ -5,8 +5,9 @@ import (
student "student"
"./correct"
"github.com/01-edu/public/go/lib"
"func/correct"
"lib"
)
type NodeI13 = student.NodeI

5
go/tests/func/sortlistinsert_test/main.go

@ -5,8 +5,9 @@ import (
student "student"
"./correct"
"github.com/01-edu/public/go/lib"
"func/correct"
"lib"
)
type NodeI14 = student.NodeI

Loading…
Cancel
Save