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.
64 lines
1.1 KiB
64 lines
1.1 KiB
package cap3
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
)
|
|
|
|
func TestWork1(t *testing.T) {
|
|
result := Work1(100)
|
|
for _, b := range result {
|
|
fmt.Print(b)
|
|
}
|
|
|
|
fmt.Println()
|
|
}
|
|
|
|
func _printMatrix(matrix [][]int) {
|
|
for _, row := range matrix {
|
|
for _, element := range row {
|
|
fmt.Printf("%d\t", element)
|
|
}
|
|
fmt.Println()
|
|
}
|
|
}
|
|
|
|
func TestWork2(t *testing.T) {
|
|
matrix := Work2([]int{5, 7, 4, 8, 9, 1})
|
|
_printMatrix(matrix)
|
|
|
|
println("----------------")
|
|
|
|
matrix = Work2type2([]int{5, 7, 4, 8, 9, 1})
|
|
_printMatrix(matrix)
|
|
}
|
|
|
|
func TestWork3(t *testing.T) {
|
|
matrix := Work3(7)
|
|
_printMatrix(matrix)
|
|
|
|
fmt.Println("----------------")
|
|
|
|
matrix = Work3(6)
|
|
_printMatrix(matrix)
|
|
}
|
|
|
|
func TestWork4(t *testing.T) {
|
|
matrix := Work4(5)
|
|
_printMatrix(matrix)
|
|
}
|
|
|
|
func TestWork5(t *testing.T) {
|
|
matrix := Work5(6)
|
|
_printMatrix(matrix)
|
|
|
|
fmt.Println("----------------")
|
|
|
|
matrix = Work5(5)
|
|
_printMatrix(matrix)
|
|
|
|
fmt.Println("----------------")
|
|
|
|
matrix = Work5(10)
|
|
_printMatrix(matrix)
|
|
}
|
|
|