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 078e5420..48984f8d 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 b6480dd7..37f4f832 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 89456ac5..10f5c901 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 56906399..c45f85fc 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 8e7e9fc4..b6691f23 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 6df75ea8..831c6d6f 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 3e38b3cd..0bfab51d 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 904ded74..8e8eb53b 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 c65f0c3d..ca5588f9 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 b24350da..d00fa76d 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 6a563679..bd66a05d 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 1d085b56..0cd43487 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 e957feb6..220cc545 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 44170e74..17687b42 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 73266f04..88c0aa42 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 4f2691f8..9c002422 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 14b204da..91e8d54c 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 ebb4837a..ffa93bd6 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 4783b052..62cb849c 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 4c186d12..098ac81e 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 e49768c8..d439c205 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 aed41724..3873aaab 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 a9866e0b..634fc8c3 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")