-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun-tests-go.txt
950 lines (651 loc) · 28.7 KB
/
run-tests-go.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
Running automated test file(s):
Go packages: electionday
===============================================================================
Running: ../../.github/citools/go/go-lint-golangci-lint
Running GoLangCi-Lint
Go version:
go version go1.21.0 linux/amd64
==============================================================================
Running: go clean ./...
real 0m0.031s
user 0m0.022s
sys 0m0.034s
==============================================================================
Running: golangci-lint run --enable-all ./...
level=warning msg="[runner] The linter 'exhaustivestruct' is deprecated (since v1.46.0) due to: The owner seems to have abandoned the linter. Replaced by exhaustruct."
level=warning msg="[runner] The linter 'nosnakecase' is deprecated (since v1.48.1) due to: The repository of the linter has been deprecated by the owner. Replaced by revive(var-naming)."
level=warning msg="[runner] The linter 'ifshort' is deprecated (since v1.48.0) due to: The repository of the linter has been deprecated by the owner. "
level=warning msg="[runner] The linter 'scopelint' is deprecated (since v1.39.0) due to: The repository of the linter has been deprecated by the owner. Replaced by exportloopref."
level=warning msg="[runner] The linter 'golint' is deprecated (since v1.41.0) due to: The repository of the linter has been archived by the owner. Replaced by revive."
level=warning msg="[runner] The linter 'interfacer' is deprecated (since v1.38.0) due to: The repository of the linter has been archived by the owner. "
level=warning msg="[runner] The linter 'deadcode' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused."
level=warning msg="[runner] The linter 'structcheck' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused."
level=warning msg="[runner] The linter 'varcheck' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused."
level=warning msg="[runner] The linter 'maligned' is deprecated (since v1.38.0) due to: The repository of the linter has been archived by the owner. Replaced by govet 'fieldalignment'."
election_day.go:30:61: Comment should end in a period (godot)
// IncrementVoteCount increments the value in a vote counter
^
election_day.go:39:51: Comment should end in a period (godot)
// NewElectionResult creates a new election result
^
election_day.go:49:67: Comment should end in a period (godot)
// DisplayResult creates a message with the result to be displayed
^
election_day_examples_test.go:79: File is not `gofumpt`-ed (gofumpt)
var finalResults = map[string]int{
election_day.go:41:13: var-declaration: should omit type ElectionResult from declaration of var result; it will be inferred from the right-hand side (revive)
var result ElectionResult = ElectionResult{
^
election_day_test.go:21:26: Using the variable on range scope `tt` in function literal (scopelint)
got := NewVoteCounter(tt.votes)
^
election_day_test.go:23:46: Using the variable on range scope `tt` in function literal (scopelint)
t.Errorf("NewVoteCounter(%d) = %s, &%d", tt.votes, intPtrRepresentation(got), tt.votes)
^
election_day_test.go:25:29: Using the variable on range scope `tt` in function literal (scopelint)
if got != nil && *got != tt.votes {
^
election_day_examples_test.go:9:2: declarations should never be cuddled (wsl)
var counter *int
^
election_day_examples_test.go:37:2: declarations should never be cuddled (wsl)
var voteCounter *int
^
election_day_test.go:196:2: return statements should not be cuddled if block has more than two lines (wsl)
return "&" + strconv.Itoa(*p)
^
election_day_examples_test.go:48:2: Duplicate words (true) found (dupword)
// true
^
election_day_examples_test.go:60:2: Duplicate words (true) found (dupword)
// true
^
election_day.go:10:2: S1021: should merge variable declaration with assignment on next line (gosimple)
var counter *int
^
election_day.go:51:2: S1021: should merge variable declaration with assignment on next line (gosimple)
var message string
^
election_day_examples_test.go:20:2: S1021: should merge variable declaration with assignment on next line (gosimple)
var votes int
^
election_day_test.go:8:1: Function TestNewVoteCounter missing the call to method parallel (paralleltest)
func TestNewVoteCounter(t *testing.T) {
^
election_day_test.go:19:2: Range statement for test TestNewVoteCounter missing the call to method parallel in test Run (paralleltest)
for _, tt := range tests {
^
election_day_test.go:32:1: Function TestVoteCount missing the call to method parallel (paralleltest)
func TestVoteCount(t *testing.T) {
^
election_day_test.go:52:2: Range statement for test TestVoteCount missing the call to method parallel in test Run (paralleltest)
for _, tt := range tests {
^
election_day_test.go:61:1: Function TestIncrementVoteCount missing the call to method parallel (paralleltest)
func TestIncrementVoteCount(t *testing.T) {
^
election_day_test.go:92:2: Range statement for test TestIncrementVoteCount missing the call to method parallel in test Run (paralleltest)
for _, tt := range tests {
^
election_day_test.go:109:1: Function TestNewElectionResult missing the call to method parallel (paralleltest)
func TestNewElectionResult(t *testing.T) {
^
election_day_test.go:127:2: Range statement for test TestNewElectionResult missing the call to method parallel in test Run (paralleltest)
for _, tt := range tests {
^
election_day_test.go:139:1: Function TestDisplayResult missing the call to method parallel (paralleltest)
func TestDisplayResult(t *testing.T) {
^
election_day_test.go:155:2: Range statement for test TestDisplayResult missing the call to method parallel in test Run (paralleltest)
for _, tt := range tests {
^
election_day_test.go:164:1: Function TestDecrementVotesOfCandidate missing the call to method parallel (paralleltest)
func TestDecrementVotesOfCandidate(t *testing.T) {
^
election_day_test.go:181:2: Range statement for test TestDecrementVotesOfCandidate missing the call to method parallel in test Run (paralleltest)
for _, tt := range tests {
^
election_day_examples_test.go:1:9: package should be `electionday_test` instead of `electionday` (testpackage)
package electionday
^
election_day_test.go:1:9: package should be `electionday_test` instead of `electionday` (testpackage)
package electionday
^
real 0m0.479s
user 0m0.693s
sys 0m0.443s
==============================================================================
Exit code: -1
real 0m0.535s
user 0m0.727s
sys 0m0.491s
real 0m0.538s
user 0m0.728s
sys 0m0.493s
===============================================================================
Running: ../../.github/citools/go/go-lint-revive
Running Go Lint Revive
Go version:
go version go1.21.0 linux/amd64
==============================================================================
Running: go clean ./...
real 0m0.022s
user 0m0.013s
sys 0m0.030s
==============================================================================
Running: revive -formatter=stylish ./...
election_day.go
(1, 1) https://revive.run/r#package-comments should have a package comment
(41, 13) https://revive.run/r#var-declaration should omit type ElectionResult from declaration of var result; it will be inferred from the right-hand side
✖ 2 problems (0 errors) (2 warnings)
real 0m0.038s
user 0m0.027s
sys 0m0.025s
==============================================================================
Exit code: 0
real 0m0.072s
user 0m0.047s
sys 0m0.062s
real 0m0.074s
user 0m0.049s
sys 0m0.063s
===============================================================================
Running: ../../.github/citools/go/go-lint-ineffassign
../run-tests: line 41: .github/citools/go/go-lint-ineffassign: No such file or directory
real 0m0.001s
user 0m0.001s
sys 0m0.000s
===============================================================================
Running: ../../.github/citools/go/go-lint-go-consistent
Running Go go-consistent
Go version:
go version go1.21.0 linux/amd64
==============================================================================
Running: go clean ./...
real 0m0.042s
user 0m0.024s
sys 0m0.045s
==============================================================================
Running: go-consistent -v ./...
info: check "./."
internal error: package "fmt" without types was imported from "electionday"
real 0m0.108s
user 0m0.141s
sys 0m0.159s
==============================================================================
Exit code: -1
real 0m0.168s
user 0m0.171s
sys 0m0.221s
real 0m0.169s
user 0m0.172s
sys 0m0.222s
===============================================================================
Running: ../../.github/citools/go/go-lint-staticcheck
Running Go StaticCheck
Go version:
go version go1.21.0 linux/amd64
==============================================================================
Running: go clean ./...
real 0m0.022s
user 0m0.015s
sys 0m0.021s
==============================================================================
Running: staticcheck -checks=all ./...
election_day.go:1:1: at least one file in a package should have a package comment (ST1000)
election_day.go:10:2: should merge variable declaration with assignment on next line (S1021)
election_day.go:41:13: should omit type ElectionResult from declaration; it will be inferred from the right-hand side (ST1023)
election_day.go:51:2: should merge variable declaration with assignment on next line (S1021)
election_day_examples_test.go:20:2: should merge variable declaration with assignment on next line (S1021)
election_day_examples_test.go:23:2: should merge variable declaration with assignment on next line (S1021)
election_day_examples_test.go:52:2: should merge variable declaration with assignment on next line (S1021)
election_day_examples_test.go:64:2: should merge variable declaration with assignment on next line (S1021)
election_result.go:1:1: at least one file in a package should have a package comment (ST1000)
real 0m0.176s
user 0m0.214s
sys 0m0.138s
==============================================================================
Exit code: -1
real 0m0.208s
user 0m0.235s
sys 0m0.166s
real 0m0.210s
user 0m0.235s
sys 0m0.168s
===============================================================================
Running: ../../.github/citools/go/go-lint-gocritic
Running Go gocritic
Go version:
go version go1.21.0 linux/amd64
==============================================================================
Running: go clean ./...
real 0m0.023s
user 0m0.025s
sys 0m0.020s
==============================================================================
Running: gocritic check -enableAll ./...
real 0m0.776s
user 0m1.862s
sys 0m0.326s
==============================================================================
Exit code: 0
real 0m0.810s
user 0m1.890s
sys 0m0.360s
real 0m0.812s
user 0m1.891s
sys 0m0.361s
===============================================================================
Running: ../../.github/citools/go/go-lint-go_vet
Running Go Vet
Go version:
go version go1.21.0 linux/amd64
==============================================================================
Running: go clean ./...
real 0m0.021s
user 0m0.011s
sys 0m0.024s
==============================================================================
Running: go vet ./...
real 0m0.079s
user 0m0.098s
sys 0m0.097s
==============================================================================
Exit code: 0
real 0m0.110s
user 0m0.115s
sys 0m0.128s
real 0m0.112s
user 0m0.116s
sys 0m0.129s
===============================================================================
Running: ../../.github/citools/go/go-fixer-go_fix
Running go fix
Go version:
go version go1.21.0 linux/amd64
==============================================================================
Running: go clean ./...
real 0m0.022s
user 0m0.016s
sys 0m0.018s
==============================================================================
Running: go fix ./...
real 0m0.025s
user 0m0.019s
sys 0m0.023s
==============================================================================
Exit code: 0
real 0m0.058s
user 0m0.041s
sys 0m0.049s
real 0m0.060s
user 0m0.043s
sys 0m0.050s
===============================================================================
Running: ../../.github/citools/go/go-lint-errcheck
Running Go errcheck
Go version:
go version go1.21.0 linux/amd64
==============================================================================
Running: go clean ./...
real 0m0.026s
user 0m0.022s
sys 0m0.024s
==============================================================================
Running: errcheck ./...
real 0m0.456s
user 0m1.351s
sys 0m0.218s
==============================================================================
Exit code: 0
real 0m0.494s
user 0m1.377s
sys 0m0.255s
real 0m0.497s
user 0m1.377s
sys 0m0.257s
===============================================================================
Running: ../../.github/citools/go/go-lint-gocyclo
Running Go gocyclo
Go version:
go version go1.21.0 linux/amd64
==============================================================================
Running: go clean ./...
real 0m0.036s
user 0m0.027s
sys 0m0.037s
==============================================================================
Running: gocyclo .
5 electionday TestNewElectionResult election_day_test.go:109:1
5 electionday TestIncrementVoteCount election_day_test.go:61:1
5 electionday TestNewVoteCounter election_day_test.go:8:1
4 electionday TestDecrementVotesOfCandidate election_day_test.go:164:1
4 electionday DecrementVotesOfCandidate election_day.go:59:1
3 electionday TestDisplayResult election_day_test.go:139:1
3 electionday TestVoteCount election_day_test.go:32:1
2 electionday intPtrRepresentation election_day_test.go:192:1
2 electionday IncrementVoteCount election_day.go:31:1
2 electionday VoteCount election_day.go:18:1
1 electionday ExampleDecrementVotesOfCandidate election_day_examples_test.go:78:1
1 electionday ExampleDisplayResult election_day_examples_test.go:63:1
1 electionday ExampleNewElectionResult election_day_examples_test.go:51:1
1 electionday ExampleIncrementVoteCount election_day_examples_test.go:35:1
1 electionday ExampleVoteCount election_day_examples_test.go:19:1
1 electionday ExampleNewVoteCounter election_day_examples_test.go:7:1
1 electionday DisplayResult election_day.go:50:1
1 electionday NewElectionResult election_day.go:40:1
1 electionday NewVoteCounter election_day.go:9:1
real 0m0.004s
user 0m0.002s
sys 0m0.003s
==============================================================================
Exit code: 0
real 0m0.055s
user 0m0.034s
sys 0m0.053s
real 0m0.058s
user 0m0.035s
sys 0m0.055s
===============================================================================
Running: ../../.github/citools/go/go-lint-misspell
Running Go misspell
Go version:
go version go1.21.0 linux/amd64
==============================================================================
Running: misspell .
real 0m0.034s
user 0m0.032s
sys 0m0.016s
==============================================================================
Exit code: 0
real 0m0.054s
user 0m0.041s
sys 0m0.034s
real 0m0.057s
user 0m0.043s
sys 0m0.035s
===============================================================================
Running: ../../.github/citools/go/go-lint-gosec
Running Go GoSec
Go version:
go version go1.21.0 linux/amd64
==============================================================================
Running: go clean ./...
real 0m0.021s
user 0m0.015s
sys 0m0.024s
==============================================================================
Running: gosec ./...
[gosec] 2023/09/07 00:22:56 Including rules: default
[gosec] 2023/09/07 00:22:56 Excluding rules: default
[gosec] 2023/09/07 00:22:56 Import directory: /home/vpayno/git_vpayno/exercism-workspace/go/election-day
[gosec] 2023/09/07 00:22:56 Checking package: electionday
[gosec] 2023/09/07 00:22:56 Checking file: /home/vpayno/git_vpayno/exercism-workspace/go/election-day/election_day.go
[gosec] 2023/09/07 00:22:56 Checking file: /home/vpayno/git_vpayno/exercism-workspace/go/election-day/election_result.go
Results:
[1;36mSummary:[0m
Gosec : dev
Files : 2
Lines : 74
Nosec : 0
Issues : [1;32m0[0m
real 0m0.124s
user 0m0.146s
sys 0m0.106s
==============================================================================
Exit code: 0
real 0m0.157s
user 0m0.169s
sys 0m0.137s
real 0m0.159s
user 0m0.170s
sys 0m0.137s
===============================================================================
Running: ../../.github/citools/go/go-test-cover-report
Running Go Test, Coverage & Reports
Go version:
go version go1.21.0 linux/amd64
==============================================================================
Running: go clean ./...
real 0m0.035s
user 0m0.034s
sys 0m0.030s
==============================================================================
Running: gotest -v -covermode=count -coverprofile coverage.out ./...
=== RUN TestNewVoteCounter
=== RUN TestNewVoteCounter/Simple_vote_counter_with_2_votes
--- PASS: TestNewVoteCounter (0.00s)
--- PASS: TestNewVoteCounter/Simple_vote_counter_with_2_votes (0.00s)
=== RUN TestVoteCount
=== RUN TestVoteCount/Call_to_VoteCount_with_a_nil_argument
=== RUN TestVoteCount/Call_to_VoteCount_with_a_pointer_to_an_int_with_a_value_of_2
--- PASS: TestVoteCount (0.00s)
--- PASS: TestVoteCount/Call_to_VoteCount_with_a_nil_argument (0.00s)
--- PASS: TestVoteCount/Call_to_VoteCount_with_a_pointer_to_an_int_with_a_value_of_2 (0.00s)
=== RUN TestIncrementVoteCount
=== RUN TestIncrementVoteCount/Call_to_IncrementVoteCount_with_a_pointer_to_an_int_with_a_value_of_0_and_increment_of_1
=== RUN TestIncrementVoteCount/Call_to_IncrementVoteCount_with_a_pointer_to_an_int_with_a_value_of_2_and_increment_of_2
=== RUN TestIncrementVoteCount/Call_to_IncrementVoteCount_with_a_pointer_to_an_int_with_a_value_of_5_and_increment_of_7
--- PASS: TestIncrementVoteCount (0.00s)
--- PASS: TestIncrementVoteCount/Call_to_IncrementVoteCount_with_a_pointer_to_an_int_with_a_value_of_0_and_increment_of_1 (0.00s)
--- PASS: TestIncrementVoteCount/Call_to_IncrementVoteCount_with_a_pointer_to_an_int_with_a_value_of_2_and_increment_of_2 (0.00s)
--- PASS: TestIncrementVoteCount/Call_to_IncrementVoteCount_with_a_pointer_to_an_int_with_a_value_of_5_and_increment_of_7 (0.00s)
=== RUN TestNewElectionResult
=== RUN TestNewElectionResult/Call_to_NewElectionResult_for_Peter_with_2_votes
--- PASS: TestNewElectionResult (0.00s)
--- PASS: TestNewElectionResult/Call_to_NewElectionResult_for_Peter_with_2_votes (0.00s)
=== RUN TestDisplayResult
=== RUN TestDisplayResult/Call_to_DisplayResult_for_John_with_5_votes
--- PASS: TestDisplayResult (0.00s)
--- PASS: TestDisplayResult/Call_to_DisplayResult_for_John_with_5_votes (0.00s)
=== RUN TestDecrementVotesOfCandidate
=== RUN TestDecrementVotesOfCandidate/Call_to_DecrementVotesOfCandidate_for_John_with_3_votes
--- PASS: TestDecrementVotesOfCandidate (0.00s)
--- PASS: TestDecrementVotesOfCandidate/Call_to_DecrementVotesOfCandidate_for_John_with_3_votes (0.00s)
=== RUN ExampleNewVoteCounter
--- PASS: ExampleNewVoteCounter (0.00s)
=== RUN ExampleVoteCount
--- PASS: ExampleVoteCount (0.00s)
=== RUN ExampleIncrementVoteCount
--- PASS: ExampleIncrementVoteCount (0.00s)
=== RUN ExampleNewElectionResult
--- PASS: ExampleNewElectionResult (0.00s)
=== RUN ExampleDisplayResult
--- PASS: ExampleDisplayResult (0.00s)
=== RUN ExampleDecrementVotesOfCandidate
--- PASS: ExampleDecrementVotesOfCandidate (0.00s)
PASS
coverage: 94.7% of statements
ok electionday 0.002s coverage: 94.7% of statements
real 0m0.206s
user 0m0.287s
sys 0m0.190s
==============================================================================
Running: go tool cover -func=coverage.out
electionday/election_day.go:9: NewVoteCounter 100.0%
electionday/election_day.go:18: VoteCount 100.0%
electionday/election_day.go:31: IncrementVoteCount 66.7%
electionday/election_day.go:40: NewElectionResult 100.0%
electionday/election_day.go:50: DisplayResult 100.0%
electionday/election_day.go:59: DecrementVotesOfCandidate 100.0%
total: (statements) 94.7%
real 0m0.050s
user 0m0.059s
sys 0m0.064s
==============================================================================
Running: go tool cover -html coverage.out -o coverage.html
real 0m0.048s
user 0m0.063s
sys 0m0.083s
==============================================================================
Running: cover_annotate
Running: gocov convert coverage.out | gocov annotate -ceiling=100 - | tee coverage-annotations.txt
31 func IncrementVoteCount(counter *int, increment int) {
32 if counter != nil {
33 *counter += increment
34 } else {
35 MISS *counter = increment
36 }
37 }
real 0m0.022s
user 0m0.014s
sys 0m0.028s
real 0m0.022s
user 0m0.014s
sys 0m0.028s
==============================================================================
Running: gotest -v -race -covermode=atomic ./...
=== RUN TestNewVoteCounter
=== RUN TestNewVoteCounter/Simple_vote_counter_with_2_votes
--- PASS: TestNewVoteCounter (0.00s)
--- PASS: TestNewVoteCounter/Simple_vote_counter_with_2_votes (0.00s)
=== RUN TestVoteCount
=== RUN TestVoteCount/Call_to_VoteCount_with_a_nil_argument
=== RUN TestVoteCount/Call_to_VoteCount_with_a_pointer_to_an_int_with_a_value_of_2
--- PASS: TestVoteCount (0.00s)
--- PASS: TestVoteCount/Call_to_VoteCount_with_a_nil_argument (0.00s)
--- PASS: TestVoteCount/Call_to_VoteCount_with_a_pointer_to_an_int_with_a_value_of_2 (0.00s)
=== RUN TestIncrementVoteCount
=== RUN TestIncrementVoteCount/Call_to_IncrementVoteCount_with_a_pointer_to_an_int_with_a_value_of_0_and_increment_of_1
=== RUN TestIncrementVoteCount/Call_to_IncrementVoteCount_with_a_pointer_to_an_int_with_a_value_of_2_and_increment_of_2
=== RUN TestIncrementVoteCount/Call_to_IncrementVoteCount_with_a_pointer_to_an_int_with_a_value_of_5_and_increment_of_7
--- PASS: TestIncrementVoteCount (0.00s)
--- PASS: TestIncrementVoteCount/Call_to_IncrementVoteCount_with_a_pointer_to_an_int_with_a_value_of_0_and_increment_of_1 (0.00s)
--- PASS: TestIncrementVoteCount/Call_to_IncrementVoteCount_with_a_pointer_to_an_int_with_a_value_of_2_and_increment_of_2 (0.00s)
--- PASS: TestIncrementVoteCount/Call_to_IncrementVoteCount_with_a_pointer_to_an_int_with_a_value_of_5_and_increment_of_7 (0.00s)
=== RUN TestNewElectionResult
=== RUN TestNewElectionResult/Call_to_NewElectionResult_for_Peter_with_2_votes
--- PASS: TestNewElectionResult (0.00s)
--- PASS: TestNewElectionResult/Call_to_NewElectionResult_for_Peter_with_2_votes (0.00s)
=== RUN TestDisplayResult
=== RUN TestDisplayResult/Call_to_DisplayResult_for_John_with_5_votes
--- PASS: TestDisplayResult (0.00s)
--- PASS: TestDisplayResult/Call_to_DisplayResult_for_John_with_5_votes (0.00s)
=== RUN TestDecrementVotesOfCandidate
=== RUN TestDecrementVotesOfCandidate/Call_to_DecrementVotesOfCandidate_for_John_with_3_votes
--- PASS: TestDecrementVotesOfCandidate (0.00s)
--- PASS: TestDecrementVotesOfCandidate/Call_to_DecrementVotesOfCandidate_for_John_with_3_votes (0.00s)
=== RUN ExampleNewVoteCounter
--- PASS: ExampleNewVoteCounter (0.00s)
=== RUN ExampleVoteCount
--- PASS: ExampleVoteCount (0.00s)
=== RUN ExampleIncrementVoteCount
--- PASS: ExampleIncrementVoteCount (0.00s)
=== RUN ExampleNewElectionResult
--- PASS: ExampleNewElectionResult (0.00s)
=== RUN ExampleDisplayResult
--- PASS: ExampleDisplayResult (0.00s)
=== RUN ExampleDecrementVotesOfCandidate
--- PASS: ExampleDecrementVotesOfCandidate (0.00s)
PASS
coverage: 94.7% of statements
ok electionday 1.015s coverage: 94.7% of statements
real 0m1.278s
user 0m0.314s
sys 0m0.185s
==============================================================================
Exit code: 0
real 0m1.658s
user 0m0.782s
sys 0m0.594s
real 0m1.661s
user 0m0.784s
sys 0m0.595s
===============================================================================
mv -v benchstat-new.txt benchstat-old.txt
renamed 'benchstat-new.txt' -> 'benchstat-old.txt'
gotest -v --run=xxx --bench . --benchmem |& tee benchstat-new.txt
PASS
ok electionday 0.002s
real 0m0.144s
user 0m0.183s
sys 0m0.161s
===============================================================================
gotest -v -tags bonus
=== RUN TestNewVoteCounter
=== RUN TestNewVoteCounter/Simple_vote_counter_with_2_votes
--- PASS: TestNewVoteCounter (0.00s)
--- PASS: TestNewVoteCounter/Simple_vote_counter_with_2_votes (0.00s)
=== RUN TestVoteCount
=== RUN TestVoteCount/Call_to_VoteCount_with_a_nil_argument
=== RUN TestVoteCount/Call_to_VoteCount_with_a_pointer_to_an_int_with_a_value_of_2
--- PASS: TestVoteCount (0.00s)
--- PASS: TestVoteCount/Call_to_VoteCount_with_a_nil_argument (0.00s)
--- PASS: TestVoteCount/Call_to_VoteCount_with_a_pointer_to_an_int_with_a_value_of_2 (0.00s)
=== RUN TestIncrementVoteCount
=== RUN TestIncrementVoteCount/Call_to_IncrementVoteCount_with_a_pointer_to_an_int_with_a_value_of_0_and_increment_of_1
=== RUN TestIncrementVoteCount/Call_to_IncrementVoteCount_with_a_pointer_to_an_int_with_a_value_of_2_and_increment_of_2
=== RUN TestIncrementVoteCount/Call_to_IncrementVoteCount_with_a_pointer_to_an_int_with_a_value_of_5_and_increment_of_7
--- PASS: TestIncrementVoteCount (0.00s)
--- PASS: TestIncrementVoteCount/Call_to_IncrementVoteCount_with_a_pointer_to_an_int_with_a_value_of_0_and_increment_of_1 (0.00s)
--- PASS: TestIncrementVoteCount/Call_to_IncrementVoteCount_with_a_pointer_to_an_int_with_a_value_of_2_and_increment_of_2 (0.00s)
--- PASS: TestIncrementVoteCount/Call_to_IncrementVoteCount_with_a_pointer_to_an_int_with_a_value_of_5_and_increment_of_7 (0.00s)
=== RUN TestNewElectionResult
=== RUN TestNewElectionResult/Call_to_NewElectionResult_for_Peter_with_2_votes
--- PASS: TestNewElectionResult (0.00s)
--- PASS: TestNewElectionResult/Call_to_NewElectionResult_for_Peter_with_2_votes (0.00s)
=== RUN TestDisplayResult
=== RUN TestDisplayResult/Call_to_DisplayResult_for_John_with_5_votes
--- PASS: TestDisplayResult (0.00s)
--- PASS: TestDisplayResult/Call_to_DisplayResult_for_John_with_5_votes (0.00s)
=== RUN TestDecrementVotesOfCandidate
=== RUN TestDecrementVotesOfCandidate/Call_to_DecrementVotesOfCandidate_for_John_with_3_votes
--- PASS: TestDecrementVotesOfCandidate (0.00s)
--- PASS: TestDecrementVotesOfCandidate/Call_to_DecrementVotesOfCandidate_for_John_with_3_votes (0.00s)
=== RUN ExampleNewVoteCounter
--- PASS: ExampleNewVoteCounter (0.00s)
=== RUN ExampleVoteCount
--- PASS: ExampleVoteCount (0.00s)
=== RUN ExampleIncrementVoteCount
--- PASS: ExampleIncrementVoteCount (0.00s)
=== RUN ExampleNewElectionResult
--- PASS: ExampleNewElectionResult (0.00s)
=== RUN ExampleDisplayResult
--- PASS: ExampleDisplayResult (0.00s)
=== RUN ExampleDecrementVotesOfCandidate
--- PASS: ExampleDecrementVotesOfCandidate (0.00s)
PASS
ok electionday 0.002s
real 0m0.129s
user 0m0.173s
sys 0m0.134s
===============================================================================
benchstat benchstat-old.txt benchstat-new.txt
real 0m0.002s
user 0m0.000s
sys 0m0.002s
===============================================================================
gomarkdoc --output electionday-doc.md
real 0m0.010s
user 0m0.007s
sys 0m0.003s
===============================================================================
go doc -all electionday
package electionday // import "electionday"
FUNCTIONS
func DecrementVotesOfCandidate(results map[string]int, candidate string)
DecrementVotesOfCandidate decrements by one the vote count of a candidate in
a map
func DisplayResult(result *ElectionResult) string
DisplayResult creates a message with the result to be displayed
func IncrementVoteCount(counter *int, increment int)
IncrementVoteCount increments the value in a vote counter
func NewVoteCounter(initialVotes int) *int
NewVoteCounter returns a new vote counter with a given number of initial
votes.
func VoteCount(counter *int) int
VoteCount extracts the number of votes from a counter.
TYPES
type ElectionResult struct {
// Name is the name of the candidate.
Name string
// Number is the total number of votes the candidate had.
Votes int
}
ElectionResult represents an election result.
func NewElectionResult(candidateName string, votes int) *ElectionResult
NewElectionResult creates a new election result
real 0m0.036s
user 0m0.022s
sys 0m0.033s
===============================================================================