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.
107 lines
1.7 KiB
107 lines
1.7 KiB
package cap3
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
)
|
|
|
|
func TestWork1(t *testing.T) {
|
|
result := Work1(100)
|
|
for _, b := range result {
|
|
fmt.Print(b)
|
|
}
|
|
|
|
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)
|
|
}
|
|
|
|
func TestWork9(t *testing.T) {
|
|
result := Work9(1, 2)
|
|
println(result)
|
|
result = Work9(3, 6)
|
|
println(result)
|
|
}
|
|
|
|
func TestWork11(t *testing.T) {
|
|
result := Work11(4)
|
|
println(result)
|
|
|
|
result = Work11(60)
|
|
println(result)
|
|
|
|
result = Work11(1000)
|
|
println(result)
|
|
}
|
|
|
|
func TestWork15(t *testing.T) {
|
|
match := Work15()
|
|
for a, b := range match {
|
|
fmt.Println(a, " vs ", b)
|
|
}
|
|
}
|
|
|
|
func TestWork16(t *testing.T) {
|
|
result := Work16(123)
|
|
fmt.Print("can be devide by ")
|
|
for _, num := range result {
|
|
fmt.Printf("%d, ", num)
|
|
}
|
|
|
|
println()
|
|
}
|
|
|
|
func TestWork23(t *testing.T) {
|
|
digits := Work23(123456)
|
|
fmt.Printf("%d digits\n", len(digits))
|
|
|
|
for i := len(digits) - 1; i >= 0; i-- {
|
|
print(digits[i])
|
|
}
|
|
|
|
println()
|
|
|
|
for _, digit := range digits {
|
|
print(digit)
|
|
}
|
|
|
|
println()
|
|
}
|
|
|