From c1a6a60cefc7fe8c92ef2599c54756781a87a77e Mon Sep 17 00:00:00 2001 From: xpetit <32063953+xpetit@users.noreply.github.com> Date: Sun, 4 Apr 2021 21:50:22 +0200 Subject: [PATCH] Formatting --- go/tests/prog/brainfuck_test/main.go | 3 ++- go/tests/prog/chunk_test/main.go | 2 +- go/tests/prog/doop_test/main.go | 1 - go/tests/prog/foreach_test/main.go | 3 +++ go/tests/prog/grouping_prog/main.go | 1 + go/tests/prog/listat_test/main.go | 6 ++++-- go/tests/prog/listclear_test/main.go | 10 ++++++---- go/tests/prog/listfind_test/main.go | 10 ++++++---- go/tests/prog/listforeach_test/main.go | 10 ++++++---- go/tests/prog/listforeachif_test/main.go | 10 ++++++---- go/tests/prog/listlast_test/main.go | 10 ++++++---- go/tests/prog/listmerge_test/main.go | 10 ++++++---- go/tests/prog/listpushback_test/main.go | 6 ++++-- go/tests/prog/listpushfront_test/main.go | 6 ++++-- go/tests/prog/listremoveif_test/main.go | 10 ++++++---- go/tests/prog/listreverse_test/main.go | 10 ++++++---- go/tests/prog/listsize_test/main.go | 10 ++++++---- go/tests/prog/listsort_test/main.go | 6 ++++-- go/tests/prog/sortedlistmerge_test/main.go | 6 ++++-- go/tests/prog/sortlistinsert_test/main.go | 6 ++++-- go/tests/prog/split_test/main.go | 6 ++++-- go/tests/prog/tetrisoptimizer_prog/validation.go | 10 ++++++---- go/tests/prog/ztail_prog/main.go | 1 + 23 files changed, 96 insertions(+), 57 deletions(-) diff --git a/go/tests/prog/brainfuck_test/main.go b/go/tests/prog/brainfuck_test/main.go index 078e54203..48984f8d5 100644 --- a/go/tests/prog/brainfuck_test/main.go +++ b/go/tests/prog/brainfuck_test/main.go @@ -9,7 +9,8 @@ import ( func main() { // individual tests 1)Hello World! 2)Hi 3)abc 4)ABC - args := []string{"++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.", + args := []string{ + "++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.", "+++++[>++++[>++++H>+++++i<<-]>>>++\n<<<<-]>>--------.>+++++.>.", "++++++++++[>++++++++++>++++++++++>++++++++++<<<-]>---.>--.>-.>++++++++++.", "ld++++++++++++++++++++++++++++++++++++++++++++this+is++a++++comment++++++++++++++[>d+<-]>.+.+.>++++++++++.", diff --git a/go/tests/prog/chunk_test/main.go b/go/tests/prog/chunk_test/main.go index b6480dd7e..37f4f8323 100644 --- a/go/tests/prog/chunk_test/main.go +++ b/go/tests/prog/chunk_test/main.go @@ -20,7 +20,7 @@ func chunk(a []int, ch int) { result = append(result, slice) } if len(a) > 0 { - result = append(result, a[:len(a)]) + result = append(result, a[:]) } fmt.Println(result) } diff --git a/go/tests/prog/doop_test/main.go b/go/tests/prog/doop_test/main.go index 89456ac5b..10f5c9018 100644 --- a/go/tests/prog/doop_test/main.go +++ b/go/tests/prog/doop_test/main.go @@ -18,7 +18,6 @@ func main() { for _, operator := range operatorsTable { table = append(table, firstArg+" "+operator+" "+secondArg) - } } diff --git a/go/tests/prog/foreach_test/main.go b/go/tests/prog/foreach_test/main.go index 56906399a..c45f85fc1 100644 --- a/go/tests/prog/foreach_test/main.go +++ b/go/tests/prog/foreach_test/main.go @@ -17,12 +17,15 @@ func forEach(f func(int), a []int) { func add0(i int) { fmt.Println(i) } + func add1(i int) { fmt.Println(i + 1) } + func add2(i int) { fmt.Println(i + 2) } + func add3(i int) { fmt.Println(i + 3) } diff --git a/go/tests/prog/grouping_prog/main.go b/go/tests/prog/grouping_prog/main.go index 8e7e9fc49..b6691f230 100644 --- a/go/tests/prog/grouping_prog/main.go +++ b/go/tests/prog/grouping_prog/main.go @@ -52,6 +52,7 @@ func brackets(regexp, text string) { } } } + func main() { if len(os.Args) == 3 { brackets(os.Args[1], os.Args[2]) diff --git a/go/tests/prog/listat_test/main.go b/go/tests/prog/listat_test/main.go index 6df75ea8e..831c6d6fb 100644 --- a/go/tests/prog/listat_test/main.go +++ b/go/tests/prog/listat_test/main.go @@ -8,8 +8,10 @@ import ( "github.com/01-edu/public/go/tests/lib" ) -type Node5 = student.NodeL -type NodeS5 = correct.NodeL +type ( + Node5 = student.NodeL + NodeS5 = correct.NodeL +) func nodePushBackList5(l1 *Node5, l2 *NodeS5, data interface{}) (*Node5, *NodeS5) { n1 := &Node5{Data: data} diff --git a/go/tests/prog/listclear_test/main.go b/go/tests/prog/listclear_test/main.go index 3e38b3cdc..0bfab51d2 100644 --- a/go/tests/prog/listclear_test/main.go +++ b/go/tests/prog/listclear_test/main.go @@ -10,10 +10,12 @@ import ( "github.com/01-edu/public/go/tests/lib" ) -type Node4 = student.NodeL -type List4 = correct.List -type NodeS4 = correct.NodeL -type ListS4 = student.List +type ( + Node4 = student.NodeL + List4 = correct.List + NodeS4 = correct.NodeL + ListS4 = student.List +) func listToStringStu5(l *ListS4) string { var res string diff --git a/go/tests/prog/listfind_test/main.go b/go/tests/prog/listfind_test/main.go index 904ded74e..8e8eb53bd 100644 --- a/go/tests/prog/listfind_test/main.go +++ b/go/tests/prog/listfind_test/main.go @@ -8,10 +8,12 @@ import ( "github.com/01-edu/public/go/tests/lib" ) -type Node9 = student.NodeL -type List9 = correct.List -type NodeS9 = correct.NodeL -type ListS9 = student.List +type ( + Node9 = student.NodeL + List9 = correct.List + NodeS9 = correct.NodeL + ListS9 = student.List +) func listPushBackTest9(l1 *ListS9, l2 *List9, data interface{}) { n := &Node9{Data: data} diff --git a/go/tests/prog/listforeach_test/main.go b/go/tests/prog/listforeach_test/main.go index c65f0c3d0..ca5588f97 100644 --- a/go/tests/prog/listforeach_test/main.go +++ b/go/tests/prog/listforeach_test/main.go @@ -10,10 +10,12 @@ import ( "github.com/01-edu/public/go/tests/lib" ) -type Node7 = student.NodeL -type List7 = correct.List -type NodeS7 = correct.NodeL -type ListS7 = student.List +type ( + Node7 = student.NodeL + List7 = correct.List + NodeS7 = correct.NodeL + ListS7 = student.List +) func listToStringStu8(l *ListS7) string { var res string diff --git a/go/tests/prog/listforeachif_test/main.go b/go/tests/prog/listforeachif_test/main.go index b24350dad..d00fa76d8 100644 --- a/go/tests/prog/listforeachif_test/main.go +++ b/go/tests/prog/listforeachif_test/main.go @@ -10,10 +10,12 @@ import ( "github.com/01-edu/public/go/tests/lib" ) -type Node8 = student.NodeL -type List8 = correct.List -type NodeS8 = correct.NodeL -type ListS8 = student.List +type ( + Node8 = student.NodeL + List8 = correct.List + NodeS8 = correct.NodeL + ListS8 = student.List +) // function to apply, in listforeachif func addOneS(node *NodeS8) { diff --git a/go/tests/prog/listlast_test/main.go b/go/tests/prog/listlast_test/main.go index 6a5636793..bd66a05d5 100644 --- a/go/tests/prog/listlast_test/main.go +++ b/go/tests/prog/listlast_test/main.go @@ -10,10 +10,12 @@ import ( "github.com/01-edu/public/go/tests/lib" ) -type Node3 = student.NodeL -type List3 = correct.List -type NodeS3 = correct.NodeL -type ListS3 = student.List +type ( + Node3 = student.NodeL + List3 = correct.List + NodeS3 = correct.NodeL + ListS3 = student.List +) func listToStringStu9(l *ListS3) string { var res string diff --git a/go/tests/prog/listmerge_test/main.go b/go/tests/prog/listmerge_test/main.go index 1d085b567..0cd434871 100644 --- a/go/tests/prog/listmerge_test/main.go +++ b/go/tests/prog/listmerge_test/main.go @@ -10,10 +10,12 @@ import ( "github.com/01-edu/public/go/tests/lib" ) -type Node11 = student.NodeL -type List11 = correct.List -type NodeS11 = correct.NodeL -type ListS11 = student.List +type ( + Node11 = student.NodeL + List11 = correct.List + NodeS11 = correct.NodeL + ListS11 = student.List +) func listToStringStu(l *ListS11) string { var res string diff --git a/go/tests/prog/listpushback_test/main.go b/go/tests/prog/listpushback_test/main.go index e957feb6a..220cc545b 100644 --- a/go/tests/prog/listpushback_test/main.go +++ b/go/tests/prog/listpushback_test/main.go @@ -10,8 +10,10 @@ import ( "github.com/01-edu/public/go/tests/lib" ) -type ListS = correct.List -type List = student.List +type ( + ListS = correct.List + List = student.List +) func listToStringStu10(l *List) string { var res string diff --git a/go/tests/prog/listpushfront_test/main.go b/go/tests/prog/listpushfront_test/main.go index 44170e749..17687b42b 100644 --- a/go/tests/prog/listpushfront_test/main.go +++ b/go/tests/prog/listpushfront_test/main.go @@ -10,8 +10,10 @@ import ( "github.com/01-edu/public/go/tests/lib" ) -type ListSa = correct.List -type Lista = student.List +type ( + ListSa = correct.List + Lista = student.List +) func listToStringStu11(l *Lista) string { var res string diff --git a/go/tests/prog/listremoveif_test/main.go b/go/tests/prog/listremoveif_test/main.go index 73266f04b..88c0aa423 100644 --- a/go/tests/prog/listremoveif_test/main.go +++ b/go/tests/prog/listremoveif_test/main.go @@ -10,10 +10,12 @@ import ( "github.com/01-edu/public/go/tests/lib" ) -type Node10 = student.NodeL -type List10 = correct.List -type NodeS10 = correct.NodeL -type ListS10 = student.List +type ( + Node10 = student.NodeL + List10 = correct.List + NodeS10 = correct.NodeL + ListS10 = student.List +) func listToStringStu12(l *ListS10) string { var res string diff --git a/go/tests/prog/listreverse_test/main.go b/go/tests/prog/listreverse_test/main.go index 4f2691f83..9c0024226 100644 --- a/go/tests/prog/listreverse_test/main.go +++ b/go/tests/prog/listreverse_test/main.go @@ -10,10 +10,12 @@ import ( "github.com/01-edu/public/go/tests/lib" ) -type Node6 = student.NodeL -type List6 = correct.List -type NodeS6 = correct.NodeL -type ListS6 = student.List +type ( + Node6 = student.NodeL + List6 = correct.List + NodeS6 = correct.NodeL + ListS6 = student.List +) func listToStringStu13(l *ListS6) string { var res string diff --git a/go/tests/prog/listsize_test/main.go b/go/tests/prog/listsize_test/main.go index 14b204da7..91e8d54c3 100644 --- a/go/tests/prog/listsize_test/main.go +++ b/go/tests/prog/listsize_test/main.go @@ -8,10 +8,12 @@ import ( "github.com/01-edu/public/go/tests/lib" ) -type Node2 = student.NodeL -type List2 = correct.List -type NodeS2 = correct.NodeL -type ListS2 = student.List +type ( + Node2 = student.NodeL + List2 = correct.List + NodeS2 = correct.NodeL + ListS2 = student.List +) func listPushBackTest2(l *ListS2, l1 *List2, data interface{}) { n := &Node2{Data: data} diff --git a/go/tests/prog/listsort_test/main.go b/go/tests/prog/listsort_test/main.go index ebb4837a8..ffa93bd62 100644 --- a/go/tests/prog/listsort_test/main.go +++ b/go/tests/prog/listsort_test/main.go @@ -10,8 +10,10 @@ import ( "github.com/01-edu/public/go/tests/lib" ) -type NodeI12 = student.NodeI -type NodeIS12 = correct.NodeI +type ( + NodeI12 = student.NodeI + NodeIS12 = correct.NodeI +) func printListStudent(n *NodeI12) string { var res string diff --git a/go/tests/prog/sortedlistmerge_test/main.go b/go/tests/prog/sortedlistmerge_test/main.go index 4783b0522..62cb849c4 100644 --- a/go/tests/prog/sortedlistmerge_test/main.go +++ b/go/tests/prog/sortedlistmerge_test/main.go @@ -10,8 +10,10 @@ import ( "github.com/01-edu/public/go/tests/lib" ) -type NodeI13 = student.NodeI -type NodeIS13 = correct.NodeI +type ( + NodeI13 = student.NodeI + NodeIS13 = correct.NodeI +) func printListStudent1(n *NodeI13) string { var res string diff --git a/go/tests/prog/sortlistinsert_test/main.go b/go/tests/prog/sortlistinsert_test/main.go index 4c186d129..098ac81e2 100644 --- a/go/tests/prog/sortlistinsert_test/main.go +++ b/go/tests/prog/sortlistinsert_test/main.go @@ -10,8 +10,10 @@ import ( "github.com/01-edu/public/go/tests/lib" ) -type NodeI14 = student.NodeI -type NodeIS14 = correct.NodeI +type ( + NodeI14 = student.NodeI + NodeIS14 = correct.NodeI +) func listToStringStu3(n *NodeI14) string { var res string diff --git a/go/tests/prog/split_test/main.go b/go/tests/prog/split_test/main.go index e49768c8d..d439c205f 100644 --- a/go/tests/prog/split_test/main.go +++ b/go/tests/prog/split_test/main.go @@ -10,14 +10,16 @@ import ( ) func main() { - separators := []string{"!=HA=!", + separators := []string{ + "!=HA=!", "!==!", " ", "|=choumi=|", "|<=>|", lib.RandStr(3, lib.RuneRange('A', 'Z')), "<<==123==>>", - "[<>abc<>]"} + "[<>abc<>]", + } type node struct { s string diff --git a/go/tests/prog/tetrisoptimizer_prog/validation.go b/go/tests/prog/tetrisoptimizer_prog/validation.go index aed417246..3873aaab5 100644 --- a/go/tests/prog/tetrisoptimizer_prog/validation.go +++ b/go/tests/prog/tetrisoptimizer_prog/validation.go @@ -1,9 +1,11 @@ package main -const blockSize = 20 -const dot = '.' -const hashTag = '#' -const newLine = '\n' +const ( + blockSize = 20 + dot = '.' + hashTag = '#' + newLine = '\n' +) func isValidBlock(data []byte) bool { numDots, numHashtags := 0, 0 diff --git a/go/tests/prog/ztail_prog/main.go b/go/tests/prog/ztail_prog/main.go index a9866e0bf..634fc8c3c 100644 --- a/go/tests/prog/ztail_prog/main.go +++ b/go/tests/prog/ztail_prog/main.go @@ -21,6 +21,7 @@ func notNil(err error) bool { } return false } + func main() { var bytes int64 flag.Int64Var(&bytes, "c", 0, "output the last NUM bytes")