-
Notifications
You must be signed in to change notification settings - Fork 542
tournament 1.3.0: Add simple start cases, remove invalid lines #288
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
Conversation
Note that this test file was created with a test generator, as suggested by #280. The generator follows: require 'json'
data = JSON.parse(File.read(File.join(__dir__, 'canonical-data.json')))
def quote(s)
?" + s + ?"
end
def fmt(s)
return '""' if s.empty?
return quote(s.first) if s.size == 1
indent = ' ' * 8
"#{quote(s.first + '\n')}.to_string() +\n" + s[1...-1].map { |l| "#{indent}#{quote(l + '\n')} +\n" }.join + indent + quote(s.last)
end
puts 'extern crate tournament;'
data['cases'].each_with_index { |c, i|
puts
puts '#[test]'
puts '#[ignore]' if i != 0
puts "fn #{c['description'].tr(' ', ?_).tr(',()', '').downcase}() {"
puts " let input = #{fmt(c['input'])};"
puts " let expected = #{fmt(c['expected'])};"
puts
puts ' assert_eq!(tournament::tally(&input), expected);'
puts ?}
} Unfortunately the generator seems unsuitable for submitting to this repository, as it was not written in Rust. That of course does not affect the validity of this PR. |
Needed for tournament 1.3.0 new cases
"games played" has never been a tiebreaker, never in the history of tournament: * exercism/problem-specifications#22 * exercism/problem-specifications#254 There was a tie in favour of the team with more wins, but that was removed in exercism/problem-specifications#300 since it was hard to trigger. Needed for tournament 1.3.0 new cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although I do prefer a tool written in rust, I have no problem adding a test generator written in another language to the repo. Do we have some rule against this?
There is no rule; the only consideration is the concern that it will hinder contributions. If someone comes to xrust thinking the only necessary language to know is Rust, but suddenly, surprise, you also need to know a different language to be able to contribute to the generators, that's not ideal. I'm not going to have any qualms about writing and posting quick scripts until a generator written in Rust comes along and I could maybe be convinced that adding them to the repo is a good idea, but either way they'll be availble until then. |
Of course, my comment conveniently ignored the fact that we have shell scripts in this repository too |
exercism/problem-specifications#773