Browse Source

Formatting

pull/768/head
xpetit 4 years ago
parent
commit
c1a6a60cef
No known key found for this signature in database
GPG Key ID: 97C60669182C17A5
  1. 3
      go/tests/prog/brainfuck_test/main.go
  2. 2
      go/tests/prog/chunk_test/main.go
  3. 1
      go/tests/prog/doop_test/main.go
  4. 3
      go/tests/prog/foreach_test/main.go
  5. 1
      go/tests/prog/grouping_prog/main.go
  6. 6
      go/tests/prog/listat_test/main.go
  7. 10
      go/tests/prog/listclear_test/main.go
  8. 10
      go/tests/prog/listfind_test/main.go
  9. 10
      go/tests/prog/listforeach_test/main.go
  10. 10
      go/tests/prog/listforeachif_test/main.go
  11. 10
      go/tests/prog/listlast_test/main.go
  12. 10
      go/tests/prog/listmerge_test/main.go
  13. 6
      go/tests/prog/listpushback_test/main.go
  14. 6
      go/tests/prog/listpushfront_test/main.go
  15. 10
      go/tests/prog/listremoveif_test/main.go
  16. 10
      go/tests/prog/listreverse_test/main.go
  17. 10
      go/tests/prog/listsize_test/main.go
  18. 6
      go/tests/prog/listsort_test/main.go
  19. 6
      go/tests/prog/sortedlistmerge_test/main.go
  20. 6
      go/tests/prog/sortlistinsert_test/main.go
  21. 6
      go/tests/prog/split_test/main.go
  22. 10
      go/tests/prog/tetrisoptimizer_prog/validation.go
  23. 1
      go/tests/prog/ztail_prog/main.go

3
go/tests/prog/brainfuck_test/main.go

@ -9,7 +9,8 @@ import (
func main() { func main() {
// individual tests 1)Hello World! 2)Hi 3)abc 4)ABC // individual tests 1)Hello World! 2)Hi 3)abc 4)ABC
args := []string{"++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.", args := []string{
"++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.",
"+++++[>++++[>++++H>+++++i<<-]>>>++\n<<<<-]>>--------.>+++++.>.", "+++++[>++++[>++++H>+++++i<<-]>>>++\n<<<<-]>>--------.>+++++.>.",
"++++++++++[>++++++++++>++++++++++>++++++++++<<<-]>---.>--.>-.>++++++++++.", "++++++++++[>++++++++++>++++++++++>++++++++++<<<-]>---.>--.>-.>++++++++++.",
"ld++++++++++++++++++++++++++++++++++++++++++++this+is++a++++comment++++++++++++++[>d+<-]>.+.+.>++++++++++.", "ld++++++++++++++++++++++++++++++++++++++++++++this+is++a++++comment++++++++++++++[>d+<-]>.+.+.>++++++++++.",

2
go/tests/prog/chunk_test/main.go

@ -20,7 +20,7 @@ func chunk(a []int, ch int) {
result = append(result, slice) result = append(result, slice)
} }
if len(a) > 0 { if len(a) > 0 {
result = append(result, a[:len(a)]) result = append(result, a[:])
} }
fmt.Println(result) fmt.Println(result)
} }

1
go/tests/prog/doop_test/main.go

@ -18,7 +18,6 @@ func main() {
for _, operator := range operatorsTable { for _, operator := range operatorsTable {
table = append(table, firstArg+" "+operator+" "+secondArg) table = append(table, firstArg+" "+operator+" "+secondArg)
} }
} }

3
go/tests/prog/foreach_test/main.go

@ -17,12 +17,15 @@ func forEach(f func(int), a []int) {
func add0(i int) { func add0(i int) {
fmt.Println(i) fmt.Println(i)
} }
func add1(i int) { func add1(i int) {
fmt.Println(i + 1) fmt.Println(i + 1)
} }
func add2(i int) { func add2(i int) {
fmt.Println(i + 2) fmt.Println(i + 2)
} }
func add3(i int) { func add3(i int) {
fmt.Println(i + 3) fmt.Println(i + 3)
} }

1
go/tests/prog/grouping_prog/main.go

@ -52,6 +52,7 @@ func brackets(regexp, text string) {
} }
} }
} }
func main() { func main() {
if len(os.Args) == 3 { if len(os.Args) == 3 {
brackets(os.Args[1], os.Args[2]) brackets(os.Args[1], os.Args[2])

6
go/tests/prog/listat_test/main.go

@ -8,8 +8,10 @@ import (
"github.com/01-edu/public/go/tests/lib" "github.com/01-edu/public/go/tests/lib"
) )
type Node5 = student.NodeL type (
type NodeS5 = correct.NodeL Node5 = student.NodeL
NodeS5 = correct.NodeL
)
func nodePushBackList5(l1 *Node5, l2 *NodeS5, data interface{}) (*Node5, *NodeS5) { func nodePushBackList5(l1 *Node5, l2 *NodeS5, data interface{}) (*Node5, *NodeS5) {
n1 := &Node5{Data: data} n1 := &Node5{Data: data}

10
go/tests/prog/listclear_test/main.go

@ -10,10 +10,12 @@ import (
"github.com/01-edu/public/go/tests/lib" "github.com/01-edu/public/go/tests/lib"
) )
type Node4 = student.NodeL type (
type List4 = correct.List Node4 = student.NodeL
type NodeS4 = correct.NodeL List4 = correct.List
type ListS4 = student.List NodeS4 = correct.NodeL
ListS4 = student.List
)
func listToStringStu5(l *ListS4) string { func listToStringStu5(l *ListS4) string {
var res string var res string

10
go/tests/prog/listfind_test/main.go

@ -8,10 +8,12 @@ import (
"github.com/01-edu/public/go/tests/lib" "github.com/01-edu/public/go/tests/lib"
) )
type Node9 = student.NodeL type (
type List9 = correct.List Node9 = student.NodeL
type NodeS9 = correct.NodeL List9 = correct.List
type ListS9 = student.List NodeS9 = correct.NodeL
ListS9 = student.List
)
func listPushBackTest9(l1 *ListS9, l2 *List9, data interface{}) { func listPushBackTest9(l1 *ListS9, l2 *List9, data interface{}) {
n := &Node9{Data: data} n := &Node9{Data: data}

10
go/tests/prog/listforeach_test/main.go

@ -10,10 +10,12 @@ import (
"github.com/01-edu/public/go/tests/lib" "github.com/01-edu/public/go/tests/lib"
) )
type Node7 = student.NodeL type (
type List7 = correct.List Node7 = student.NodeL
type NodeS7 = correct.NodeL List7 = correct.List
type ListS7 = student.List NodeS7 = correct.NodeL
ListS7 = student.List
)
func listToStringStu8(l *ListS7) string { func listToStringStu8(l *ListS7) string {
var res string var res string

10
go/tests/prog/listforeachif_test/main.go

@ -10,10 +10,12 @@ import (
"github.com/01-edu/public/go/tests/lib" "github.com/01-edu/public/go/tests/lib"
) )
type Node8 = student.NodeL type (
type List8 = correct.List Node8 = student.NodeL
type NodeS8 = correct.NodeL List8 = correct.List
type ListS8 = student.List NodeS8 = correct.NodeL
ListS8 = student.List
)
// function to apply, in listforeachif // function to apply, in listforeachif
func addOneS(node *NodeS8) { func addOneS(node *NodeS8) {

10
go/tests/prog/listlast_test/main.go

@ -10,10 +10,12 @@ import (
"github.com/01-edu/public/go/tests/lib" "github.com/01-edu/public/go/tests/lib"
) )
type Node3 = student.NodeL type (
type List3 = correct.List Node3 = student.NodeL
type NodeS3 = correct.NodeL List3 = correct.List
type ListS3 = student.List NodeS3 = correct.NodeL
ListS3 = student.List
)
func listToStringStu9(l *ListS3) string { func listToStringStu9(l *ListS3) string {
var res string var res string

10
go/tests/prog/listmerge_test/main.go

@ -10,10 +10,12 @@ import (
"github.com/01-edu/public/go/tests/lib" "github.com/01-edu/public/go/tests/lib"
) )
type Node11 = student.NodeL type (
type List11 = correct.List Node11 = student.NodeL
type NodeS11 = correct.NodeL List11 = correct.List
type ListS11 = student.List NodeS11 = correct.NodeL
ListS11 = student.List
)
func listToStringStu(l *ListS11) string { func listToStringStu(l *ListS11) string {
var res string var res string

6
go/tests/prog/listpushback_test/main.go

@ -10,8 +10,10 @@ import (
"github.com/01-edu/public/go/tests/lib" "github.com/01-edu/public/go/tests/lib"
) )
type ListS = correct.List type (
type List = student.List ListS = correct.List
List = student.List
)
func listToStringStu10(l *List) string { func listToStringStu10(l *List) string {
var res string var res string

6
go/tests/prog/listpushfront_test/main.go

@ -10,8 +10,10 @@ import (
"github.com/01-edu/public/go/tests/lib" "github.com/01-edu/public/go/tests/lib"
) )
type ListSa = correct.List type (
type Lista = student.List ListSa = correct.List
Lista = student.List
)
func listToStringStu11(l *Lista) string { func listToStringStu11(l *Lista) string {
var res string var res string

10
go/tests/prog/listremoveif_test/main.go

@ -10,10 +10,12 @@ import (
"github.com/01-edu/public/go/tests/lib" "github.com/01-edu/public/go/tests/lib"
) )
type Node10 = student.NodeL type (
type List10 = correct.List Node10 = student.NodeL
type NodeS10 = correct.NodeL List10 = correct.List
type ListS10 = student.List NodeS10 = correct.NodeL
ListS10 = student.List
)
func listToStringStu12(l *ListS10) string { func listToStringStu12(l *ListS10) string {
var res string var res string

10
go/tests/prog/listreverse_test/main.go

@ -10,10 +10,12 @@ import (
"github.com/01-edu/public/go/tests/lib" "github.com/01-edu/public/go/tests/lib"
) )
type Node6 = student.NodeL type (
type List6 = correct.List Node6 = student.NodeL
type NodeS6 = correct.NodeL List6 = correct.List
type ListS6 = student.List NodeS6 = correct.NodeL
ListS6 = student.List
)
func listToStringStu13(l *ListS6) string { func listToStringStu13(l *ListS6) string {
var res string var res string

10
go/tests/prog/listsize_test/main.go

@ -8,10 +8,12 @@ import (
"github.com/01-edu/public/go/tests/lib" "github.com/01-edu/public/go/tests/lib"
) )
type Node2 = student.NodeL type (
type List2 = correct.List Node2 = student.NodeL
type NodeS2 = correct.NodeL List2 = correct.List
type ListS2 = student.List NodeS2 = correct.NodeL
ListS2 = student.List
)
func listPushBackTest2(l *ListS2, l1 *List2, data interface{}) { func listPushBackTest2(l *ListS2, l1 *List2, data interface{}) {
n := &Node2{Data: data} n := &Node2{Data: data}

6
go/tests/prog/listsort_test/main.go

@ -10,8 +10,10 @@ import (
"github.com/01-edu/public/go/tests/lib" "github.com/01-edu/public/go/tests/lib"
) )
type NodeI12 = student.NodeI type (
type NodeIS12 = correct.NodeI NodeI12 = student.NodeI
NodeIS12 = correct.NodeI
)
func printListStudent(n *NodeI12) string { func printListStudent(n *NodeI12) string {
var res string var res string

6
go/tests/prog/sortedlistmerge_test/main.go

@ -10,8 +10,10 @@ import (
"github.com/01-edu/public/go/tests/lib" "github.com/01-edu/public/go/tests/lib"
) )
type NodeI13 = student.NodeI type (
type NodeIS13 = correct.NodeI NodeI13 = student.NodeI
NodeIS13 = correct.NodeI
)
func printListStudent1(n *NodeI13) string { func printListStudent1(n *NodeI13) string {
var res string var res string

6
go/tests/prog/sortlistinsert_test/main.go

@ -10,8 +10,10 @@ import (
"github.com/01-edu/public/go/tests/lib" "github.com/01-edu/public/go/tests/lib"
) )
type NodeI14 = student.NodeI type (
type NodeIS14 = correct.NodeI NodeI14 = student.NodeI
NodeIS14 = correct.NodeI
)
func listToStringStu3(n *NodeI14) string { func listToStringStu3(n *NodeI14) string {
var res string var res string

6
go/tests/prog/split_test/main.go

@ -10,14 +10,16 @@ import (
) )
func main() { func main() {
separators := []string{"!=HA=!", separators := []string{
"!=HA=!",
"!==!", "!==!",
" ", " ",
"|=choumi=|", "|=choumi=|",
"|<=>|", "|<=>|",
lib.RandStr(3, lib.RuneRange('A', 'Z')), lib.RandStr(3, lib.RuneRange('A', 'Z')),
"<<==123==>>", "<<==123==>>",
"[<>abc<>]"} "[<>abc<>]",
}
type node struct { type node struct {
s string s string

10
go/tests/prog/tetrisoptimizer_prog/validation.go

@ -1,9 +1,11 @@
package main package main
const blockSize = 20 const (
const dot = '.' blockSize = 20
const hashTag = '#' dot = '.'
const newLine = '\n' hashTag = '#'
newLine = '\n'
)
func isValidBlock(data []byte) bool { func isValidBlock(data []byte) bool {
numDots, numHashtags := 0, 0 numDots, numHashtags := 0, 0

1
go/tests/prog/ztail_prog/main.go

@ -21,6 +21,7 @@ func notNil(err error) bool {
} }
return false return false
} }
func main() { func main() {
var bytes int64 var bytes int64
flag.Int64Var(&bytes, "c", 0, "output the last NUM bytes") flag.Int64Var(&bytes, "c", 0, "output the last NUM bytes")

Loading…
Cancel
Save