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

Rewrite tests and example for CustomSet #226

Merged
merged 1 commit into from
Aug 22, 2016

Conversation

devonestes
Copy link
Contributor

@devonestes devonestes commented Aug 20, 2016

We have a lot of issues open around the CustomSet example. This PR rewrites
that to remove the deprecated Set module, and also updates it to use the
current tests listed in the exercism/x-common repo.

resolves #121
resolves #180
resolves #189
resolves #198
resolves #217

@devonestes devonestes force-pushed the rewrite-custom-set branch 2 times, most recently from eb6bf94 to 1539db4 Compare August 20, 2016 20:47
@parkerl
Copy link
Contributor

parkerl commented Aug 21, 2016

@devonestes excellent work as usual! I think I have a couple small comments. This diff is a little challenging to review. I'm mostly looking at it as a new exercise.

test "sets with elements are not empty" do
custom_set = CustomSet.new([1])
assert CustomSet.empty?(custom_set) == false
end
end

@tag :pending
Copy link
Contributor

Choose a reason for hiding this comment

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

I like the describe blocks. Are you at all worried that @pending these blocks will make too many test go red at one time? It seems ok since each is focused on one function.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Frankly, I didn't really think about it too much since that was a refactor. But now that you mention it, I don't think it's a problem. When I was doing the implementation for these, the examples in the tests pretty much all went green at the same time since there aren't really many edge cases to handle in these operations.

We have a lot of issues open around the `CustomSet` example. This PR rewrites
that to remove the deprecated `Set` module, and also updates it to use the
current tests listed in the `exercism/x-common` repo.

This should address Issues exercism#121, exercism#180, exercism#189, exercism#198 and exercism#217.
devonestes added a commit to devonestes/xelixir that referenced this pull request Aug 21, 2016
When we ran `mix test` we were getting several compiler warnings. Here's the
ouput that we got before this PR:

```
warning: behaviour Set undefined
  exercises/custom-set/example.exs:1

warning: the Inspect protocol has already been consolidated, an implementation for CustomSet has no effect
  exercises/custom-set/example.exs:126

warning: function digits/1 is private, @doc's are always discarded for private functions
  exercises/largest-series-product/example.exs:3

warning: function slices/2 is private, @doc's are always discarded for private functions
  exercises/largest-series-product/example.exs:17

warning: redefining module DNA (current version defined in memory)
  exercises/nucleotide-count/example.exs:1

warning: redefining module DNA (current version defined in memory)
  exercises/rna-transcription/example.exs:1

Including tags: [:pending]

warning: redefining module ChangeTest (current version defined in memory)
  exercises/flatten-array/flatten_array_test.exs:8

warning: redefining module ChangeTest (current version defined in memory)
  exercises/hexadecimal/hexadecimal_test.exs:8

warning: redefining module DNATest (current version defined in memory)
  exercises/nucleotide-count/nucleotide_count_test.exs:8

warning: redefining module DNATest (current version defined in memory)
  exercises/rna-transcription/rna_transcription_test.exs:8

warning: the Inspect protocol has already been consolidated, an implementation for BinTree has no effect
  exercises/zipper/zipper_test.exs:16
```

I addressed all of the warnings except those for `CustomSet` since those
warnings are taken care of in exercism#226. Many of them were naming issues for
modules, and funny enough this fix of the compiler warnings pointed out that we
had a typo in a test that should have failed but wasn't failing! I've also
fixed that typo.
parkerl pushed a commit that referenced this pull request Aug 21, 2016
When we ran `mix test` we were getting several compiler warnings. Here's the
ouput that we got before this PR:

```
warning: behaviour Set undefined
  exercises/custom-set/example.exs:1

warning: the Inspect protocol has already been consolidated, an implementation for CustomSet has no effect
  exercises/custom-set/example.exs:126

warning: function digits/1 is private, @doc's are always discarded for private functions
  exercises/largest-series-product/example.exs:3

warning: function slices/2 is private, @doc's are always discarded for private functions
  exercises/largest-series-product/example.exs:17

warning: redefining module DNA (current version defined in memory)
  exercises/nucleotide-count/example.exs:1

warning: redefining module DNA (current version defined in memory)
  exercises/rna-transcription/example.exs:1

Including tags: [:pending]

warning: redefining module ChangeTest (current version defined in memory)
  exercises/flatten-array/flatten_array_test.exs:8

warning: redefining module ChangeTest (current version defined in memory)
  exercises/hexadecimal/hexadecimal_test.exs:8

warning: redefining module DNATest (current version defined in memory)
  exercises/nucleotide-count/nucleotide_count_test.exs:8

warning: redefining module DNATest (current version defined in memory)
  exercises/rna-transcription/rna_transcription_test.exs:8

warning: the Inspect protocol has already been consolidated, an implementation for BinTree has no effect
  exercises/zipper/zipper_test.exs:16
```

I addressed all of the warnings except those for `CustomSet` since those
warnings are taken care of in #226. Many of them were naming issues for
modules, and funny enough this fix of the compiler warnings pointed out that we
had a typo in a test that should have failed but wasn't failing! I've also
fixed that typo.
@parkerl
Copy link
Contributor

parkerl commented Aug 22, 2016

Looks great! 🎉

@parkerl parkerl merged commit faf6f19 into exercism:master Aug 22, 2016
@devonestes devonestes deleted the rewrite-custom-set branch August 22, 2016 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants