Repository navigation
word-search: add to track - #617
Conversation
| expectedLocations.put("clojure", Optional.of(new WordLocation(new Pair(1, 10), new Pair(7, 10)))); | ||
|
|
||
| final Map<String, Optional<WordLocation>> actualLocations = wordSearcher.search( | ||
| expectedLocations.keySet(), |
There was a problem hiding this comment.
Not sure how I feel about this... inviting comments!
There was a problem hiding this comment.
I think keeping it like this is okay :) It might be a bit clearer to declare the set separately and name it wordsToSearchFor or something. But it's fine as it is :)
|
I helped write the canonical data for this exercise, and at the time I advocated for this "building up" of the search list as the tests progress; however, after implementing, I'm not convinced. In a real system, if e.g. search left to right behavior was to suffer from a regression, every single test would break at once. Other tracks (pre- canonical data) had passed in a single-item list for all but the final test, and then had a final check that all words could be found simultaneously. There's still some crossover there, but less (max 2 tests fail if any search direction suffers from a regression). 🤷♂️ |
c78dbf6 to
b2bebe2
Compare
| "topics": [] | ||
| }, | ||
| { | ||
| "slug": "word-search", |
FridaTveit
left a comment
There was a problem hiding this comment.
Looks great! :) Just a couple of questions :)
| Pair pair = (Pair) o; | ||
|
|
||
| if (x != pair.x) return false; | ||
| return y == pair.y; |
There was a problem hiding this comment.
Why can't this be return x == pair.x && y == pair.y?
There was a problem hiding this comment.
It can, nice spot! (IntelliJ generated this implementation for me 😇.)
There was a problem hiding this comment.
That's strange that it would generate it like that... So do you want to simplify it? :)
|
|
||
| dependencies { | ||
| testCompile "junit:junit:4.12" | ||
| } |
| expectedLocations.put("clojure", Optional.of(new WordLocation(new Pair(1, 10), new Pair(7, 10)))); | ||
|
|
||
| final Map<String, Optional<WordLocation>> actualLocations = wordSearcher.search( | ||
| expectedLocations.keySet(), |
There was a problem hiding this comment.
I think keeping it like this is okay :) It might be a bit clearer to declare the set separately and name it wordsToSearchFor or something. But it's fine as it is :)
|
@FridaTveit updated! |
FridaTveit
left a comment
There was a problem hiding this comment.
Looks great! :) Just one thing which can be simplified :)
| Pair pair = (Pair) o; | ||
|
|
||
| if (x != pair.x) return false; | ||
| return y == pair.y; |
There was a problem hiding this comment.
That's strange that it would generate it like that... So do you want to simplify it? :)
|
Updated, building now! |
FridaTveit
left a comment
There was a problem hiding this comment.
Looks great, thanks @stkent! :)
x-common directory
Reviewer Resources:
Track Policies