mirror of https://github.com/01-edu/public.git
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.
33 lines
561 B
33 lines
561 B
5 years ago
|
package main
|
||
5 years ago
|
|
||
|
import (
|
||
|
"reflect"
|
||
5 years ago
|
"sort"
|
||
5 years ago
|
|
||
5 years ago
|
"./student"
|
||
5 years ago
|
)
|
||
|
|
||
5 years ago
|
func sortIntegerTable(a []int) {
|
||
|
sort.Ints(a)
|
||
|
}
|
||
|
|
||
5 years ago
|
func main() {
|
||
5 years ago
|
i := 0
|
||
5 years ago
|
for i < lib.SliceLen {
|
||
|
table1 := lib.MultRandIntBetween(-100, 100)
|
||
5 years ago
|
|
||
5 years ago
|
tableCopyBefore := make([]int, len(table1))
|
||
|
copy(tableCopyBefore, table1)
|
||
5 years ago
|
|
||
5 years ago
|
table2 := make([]int, len(table1))
|
||
|
copy(table2, table1)
|
||
5 years ago
|
|
||
5 years ago
|
student.SortIntegerTable(table1)
|
||
5 years ago
|
sortIntegerTable(table2)
|
||
5 years ago
|
if !reflect.DeepEqual(table1, table2) {
|
||
5 years ago
|
lib.Fatalf("SortIntegerTable(%v), table1 == %v instead of %v ", tableCopyBefore, table1, table2)
|
||
5 years ago
|
}
|
||
|
i++
|
||
|
}
|
||
|
}
|