Refactor & Beautify & destruction commit
return early, remove else branches, reorder conditions and top-level functions, remove empty lines, remove unnecessary append(), fix typos, stop using testing package, remove dead code, fix mistakes in subjects, tests and solutions, remove disclaimers, reformat comments, simplify solutions, tests, add more instructions to subjects, remove obsolete files, etc.
Some of the reasons behind those modifications will be added to good-practices.en.md
Some of the exercises are now broken, they will have to be fixed, most of them have a "TODO:" comment.
5 years ago
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
student "student"
|
|
|
|
|
|
|
|
"func/correct"
|
|
|
|
|
|
|
|
"lib"
|
|
|
|
)
|
|
|
|
|
|
|
|
func errorMessage_search(fn interface{}, root, a *correct.TreeNode, b *student.TreeNode,
|
|
|
|
seaVal string) {
|
|
|
|
lib.Fatalf("%s(\n%s\n, %s) == %s instead of %s\n",
|
Refactor & Beautify & destruction commit
return early, remove else branches, reorder conditions and top-level functions, remove empty lines, remove unnecessary append(), fix typos, stop using testing package, remove dead code, fix mistakes in subjects, tests and solutions, remove disclaimers, reformat comments, simplify solutions, tests, add more instructions to subjects, remove obsolete files, etc.
Some of the reasons behind those modifications will be added to good-practices.en.md
Some of the exercises are now broken, they will have to be fixed, most of them have a "TODO:" comment.
5 years ago
|
|
|
"BTreeSearchItem",
|
|
|
|
correct.FormatTree(root),
|
|
|
|
seaVal,
|
|
|
|
b.Data,
|
|
|
|
a.Data,
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
func CompareNode_search(fn interface{}, arg1, a *correct.TreeNode, b *student.TreeNode,
|
|
|
|
seaVal string) {
|
|
|
|
if a == nil && b == nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
if (a == nil && b != nil) || (b == nil && a != nil) {
|
|
|
|
lib.Fatalf("Expected %v instead of %v\n", a, b)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
if a.Data != b.Data {
|
Refactor & Beautify & destruction commit
return early, remove else branches, reorder conditions and top-level functions, remove empty lines, remove unnecessary append(), fix typos, stop using testing package, remove dead code, fix mistakes in subjects, tests and solutions, remove disclaimers, reformat comments, simplify solutions, tests, add more instructions to subjects, remove obsolete files, etc.
Some of the reasons behind those modifications will be added to good-practices.en.md
Some of the exercises are now broken, they will have to be fixed, most of them have a "TODO:" comment.
5 years ago
|
|
|
errorMessage_search(fn, arg1, a, b, seaVal)
|
|
|
|
}
|
|
|
|
|
|
|
|
if a.Parent != nil && b.Parent != nil {
|
|
|
|
if a.Parent.Data != b.Parent.Data {
|
Refactor & Beautify & destruction commit
return early, remove else branches, reorder conditions and top-level functions, remove empty lines, remove unnecessary append(), fix typos, stop using testing package, remove dead code, fix mistakes in subjects, tests and solutions, remove disclaimers, reformat comments, simplify solutions, tests, add more instructions to subjects, remove obsolete files, etc.
Some of the reasons behind those modifications will be added to good-practices.en.md
Some of the exercises are now broken, they will have to be fixed, most of them have a "TODO:" comment.
5 years ago
|
|
|
errorMessage_search(fn, arg1, a, b, seaVal)
|
|
|
|
lib.Fatalf("Expected parent value %v instead of %v\n", a.Parent.Data, b.Parent.Data)
|
|
|
|
fmt.Println("Parent.Data", a.Parent.Data, b.Parent.Data)
|
|
|
|
}
|
|
|
|
} else if (a.Parent == nil && b.Parent != nil) || (a.Parent != nil && b.Parent == nil) {
|
|
|
|
lib.Fatalf("Expected parent value %v instead of %v\n", a.Parent, b.Parent)
|
|
|
|
}
|
|
|
|
|
|
|
|
if a.Right != nil && b.Right != nil {
|
|
|
|
if a.Right.Data != b.Right.Data {
|
Refactor & Beautify & destruction commit
return early, remove else branches, reorder conditions and top-level functions, remove empty lines, remove unnecessary append(), fix typos, stop using testing package, remove dead code, fix mistakes in subjects, tests and solutions, remove disclaimers, reformat comments, simplify solutions, tests, add more instructions to subjects, remove obsolete files, etc.
Some of the reasons behind those modifications will be added to good-practices.en.md
Some of the exercises are now broken, they will have to be fixed, most of them have a "TODO:" comment.
5 years ago
|
|
|
errorMessage_search(fn, arg1, a, b, seaVal)
|
|
|
|
lib.Fatalf("Expected right child value %v instead of %v\n", a.Right.Data, b.Right.Data)
|
|
|
|
fmt.Println("Right.Data", a.Right.Data, b.Right.Data)
|
|
|
|
}
|
|
|
|
} else if (a.Right == nil && b.Right != nil) || (a.Right != nil && b.Right == nil) {
|
|
|
|
lib.Fatalf("Expected right child value %v instead of %v\n", a.Right, b.Right)
|
|
|
|
}
|
|
|
|
|
|
|
|
if a.Left != nil && b.Left != nil {
|
|
|
|
if a.Left.Data != b.Left.Data {
|
Refactor & Beautify & destruction commit
return early, remove else branches, reorder conditions and top-level functions, remove empty lines, remove unnecessary append(), fix typos, stop using testing package, remove dead code, fix mistakes in subjects, tests and solutions, remove disclaimers, reformat comments, simplify solutions, tests, add more instructions to subjects, remove obsolete files, etc.
Some of the reasons behind those modifications will be added to good-practices.en.md
Some of the exercises are now broken, they will have to be fixed, most of them have a "TODO:" comment.
5 years ago
|
|
|
errorMessage_search(fn, arg1, a, b, seaVal)
|
|
|
|
lib.Fatalf("Expected left child value %v instead of %v\n", a.Left, b.Left)
|
|
|
|
fmt.Println("Left.Data", a.Left.Data, b.Left.Data)
|
|
|
|
}
|
|
|
|
} else if (a.Left == nil && b.Left != nil) || (a.Left != nil && b.Left == nil) {
|
|
|
|
lib.Fatalf("Expected left child value %v instead of %v\n", a, b)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Refactor & Beautify & destruction commit
return early, remove else branches, reorder conditions and top-level functions, remove empty lines, remove unnecessary append(), fix typos, stop using testing package, remove dead code, fix mistakes in subjects, tests and solutions, remove disclaimers, reformat comments, simplify solutions, tests, add more instructions to subjects, remove obsolete files, etc.
Some of the reasons behind those modifications will be added to good-practices.en.md
Some of the exercises are now broken, they will have to be fixed, most of them have a "TODO:" comment.
5 years ago
|
|
|
func main() {
|
|
|
|
root := &correct.TreeNode{Data: "04"}
|
|
|
|
rootS := &student.TreeNode{Data: "04"}
|
|
|
|
|
|
|
|
ins := []string{"01", "07", "05", "12", "02", "03", "10"}
|
|
|
|
|
|
|
|
for _, v := range ins {
|
|
|
|
root = correct.BTreeInsertData(root, v)
|
|
|
|
rootS = student.BTreeInsertData(rootS, v)
|
|
|
|
}
|
|
|
|
fn := interface{}(correct.BTreeSearchItem)
|
|
|
|
|
|
|
|
ins = append(ins, "322")
|
|
|
|
for _, v := range ins {
|
|
|
|
selectedSol := correct.BTreeSearchItem(root, v)
|
|
|
|
selectedStu := student.BTreeSearchItem(rootS, v)
|
Refactor & Beautify & destruction commit
return early, remove else branches, reorder conditions and top-level functions, remove empty lines, remove unnecessary append(), fix typos, stop using testing package, remove dead code, fix mistakes in subjects, tests and solutions, remove disclaimers, reformat comments, simplify solutions, tests, add more instructions to subjects, remove obsolete files, etc.
Some of the reasons behind those modifications will be added to good-practices.en.md
Some of the exercises are now broken, they will have to be fixed, most of them have a "TODO:" comment.
5 years ago
|
|
|
CompareNode_search(fn, root, selectedSol, selectedStu, v)
|
|
|
|
}
|
|
|
|
}
|