Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement letters for lab 03 of go-course #513

Closed
wants to merge 4 commits into from

Conversation

undrewb
Copy link
Collaborator

@undrewb undrewb commented Jun 29, 2019

Shortening variable names
Implements test of sortLetters

Implement extensive test cases

Fixes #512

Review of colleague's PR #509

Implement lab3 of anz-bank go-course

Shortening variable names
Implements test of sortLetters

Implement extensive test cases

Add main_test to git tracking
@codecov
Copy link

codecov bot commented Jun 29, 2019

Codecov Report

Merging #513 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #513     +/-   ##
=======================================
  Coverage     100%   100%             
=======================================
  Files          73    171     +98     
  Lines        1273   3184   +1911     
=======================================
+ Hits         1273   3184   +1911
Impacted Files Coverage Δ
03_letters/undrewb/main.go 100% <100%> (ø)
06_puppy/runnerdave/map_store.go 100% <0%> (ø)
10_rest/n0npax/cmd/puppy-server/main.go 100% <0%> (ø)
06_puppy/mohitnag/main.go 100% <0%> (ø)
10_rest/n0npax/pkg/puppy/errors.go 100% <0%> (ø)
08_project/willshen8/cmd/puppy-server/main.go 100% <0%> (ø)
07_errors/willshen8/error.go 100% <0%> (ø)
04_numeronym/davidbroughsmyth/main.go 100% <0%> (ø)
06_puppy/pfannerj/syncstore.go 100% <0%> (ø)
03_letters/alanhillgemann/main.go 100% <0%> (ø)
... and 89 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1fb10a5...15c4d76. Read the comment docs.

Copy link
Collaborator

@runnerdave runnerdave left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good work, only minor changes

03_letters/undrewb/main.go Outdated Show resolved Hide resolved
03_letters/undrewb/main_test.go Outdated Show resolved Hide resolved
03_letters/undrewb/main_test.go Show resolved Hide resolved
03_letters/undrewb/main_test.go Outdated Show resolved Hide resolved
Copy link
Contributor

@juliaogris juliaogris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty solid - just please get rid of the unnecessary comments as @runnerdave suggested.

03_letters/undrewb/main.go Outdated Show resolved Hide resolved
03_letters/undrewb/main_test.go Outdated Show resolved Hide resolved
03_letters/undrewb/main_test.go Outdated Show resolved Hide resolved
@undrewb undrewb requested a review from samuong as a code owner August 15, 2019 10:03
Copy link
Member

@rokane rokane left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good so far, I have left some comments which I would like addressed in the test files. I think you can also simplify your test cases quite a lot and focus on identifying cases which are verifying specific things.

input string
want map[rune]int
}{
{name: "lab example", input: "aba", want: map[rune]int{97: 2, 98: 1}},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please update the values for the want section of each case so you are using the actual char values rather than int values for the runes? Makes the test cases a lot easier to read.

{name: "lab example", input: "aba", want: map[rune]int{'a': 2, 'b': 1}},


func TestLetters(t *testing.T) {
for _, tt := range lettersTestData {
tt := tt // as per sean- suggestion on this discussion https://github.com/kyoh86/scopelint/issues/4
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this might have been suggested already, but I don't think this comment is required. Can you please remove this?

}{
{name: "lab example", input: "aba", want: "a:2,b:1"},
{name: "trailing newline", input: "aba\n", want: "\n:1,a:2,b:1"},
{name: "duplicate entries", input: "\t\t\\aba\n", want: "\t:2,\n:1,\\:1,a:2,b:1"},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand that you are trying to achieve good test coverage, but I think this might be a little bit of overkill. It's important to consider what each test is trying to achieve when building out test cases. I feel that a lot of these cases are kind of testing the same thing (one repeated letter, random example, whitespace, duplicate entries, lab example) and many of these can be removed.

If you think about structuring your tests and having each test try to achieve / verify something in particular, you should be able to hit most of these cases with a couple of tests.

  • Empty input -> Corner case
  • Multiple letters (different languages if you want) -> Positive Case
  • Emoji input -> Verify data structure is using rune

Copy link
Collaborator

@runnerdave runnerdave left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good work, now it's up to the CO's 😉

@juliaogris
Copy link
Contributor

The go-course is now closed. Thank you very much for participating.

@juliaogris juliaogris closed this Feb 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Lab 3 - Letter sort by undrewb
5 participants