PageRenderTime 39ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/utils/latency/spec/score_spec.rb

http://github.com/AF83/ucengine
Ruby | 33 lines | 26 code | 6 blank | 1 comment | 0 complexity | 8b3b62b24e11a40967376e774d74035f MD5 | raw file
  1. #!/usr/bin/env ruby
  2. require "minitest/autorun"
  3. require "../lib/score"
  4. describe Score do
  5. it "append value in a new score" do
  6. s = Score.new
  7. s['toto'] << 42
  8. s['toto'].must_equal [42]
  9. end
  10. it "sort a score" do
  11. s = Score.new
  12. s['toto'] << 42
  13. s['toto'] << 41
  14. s['toto'].must_equal [42, 41]
  15. s.sort!
  16. s['toto'].must_equal [41, 42]
  17. end
  18. it "display a score as CSV" do
  19. s = Score.new
  20. s['toto'] << 42
  21. s['toto'] << 41
  22. s['toto'].must_equal [42, 41]
  23. s.sort!
  24. s.to_csv.must_equal "toto;42\n"
  25. p s.to_all_csv
  26. end
  27. end