Skip to content

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

Merged
merged 3 commits into from
May 13, 2017
Merged

tournament 1.3.0: Add simple start cases, remove invalid lines #288

merged 3 commits into from
May 13, 2017

Conversation

petertseng
Copy link
Member

@petertseng
Copy link
Member Author

petertseng commented May 13, 2017

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.
Copy link
Contributor

@ijanos ijanos left a 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?

@petertseng petertseng merged commit 2c9e6d7 into exercism:master May 13, 2017
@petertseng petertseng deleted the tourn branch May 13, 2017 20:28
@petertseng
Copy link
Member Author

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.

@petertseng
Copy link
Member Author

but suddenly, surprise, you also need to know a different language to be able to contribute to the generators

Of course, my comment conveniently ignored the fact that we have shell scripts in this repository too

@petertseng petertseng mentioned this pull request Nov 8, 2017
@petertseng petertseng added the sync/tests Keep a test suite/version in sync with exercism/problem-specifications label Feb 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sync/tests Keep a test suite/version in sync with exercism/problem-specifications
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants