|
| 1 | +require 'minitest/autorun' |
| 2 | +require_relative 'book_store' |
| 3 | + |
| 4 | +# Common test data version: 1.0.1 087ad69 |
| 5 | +class BookStoreTest < Minitest::Test |
| 6 | + def test_only_a_single_book |
| 7 | + # skip |
| 8 | + assert_equal 8.0, BookStore.calculate_price([1]) |
| 9 | + end |
| 10 | + |
| 11 | + def test_two_of_the_same_book |
| 12 | + skip |
| 13 | + assert_equal 16.0, BookStore.calculate_price([2, 2]) |
| 14 | + end |
| 15 | + |
| 16 | + def test_empty_basket |
| 17 | + skip |
| 18 | + assert_equal 0.0, BookStore.calculate_price([]) |
| 19 | + end |
| 20 | + |
| 21 | + def test_two_different_books |
| 22 | + skip |
| 23 | + assert_equal 15.2, BookStore.calculate_price([1, 2]) |
| 24 | + end |
| 25 | + |
| 26 | + def test_three_different_books |
| 27 | + skip |
| 28 | + assert_equal 21.6, BookStore.calculate_price([1, 2, 3]) |
| 29 | + end |
| 30 | + |
| 31 | + def test_four_different_books |
| 32 | + skip |
| 33 | + assert_equal 25.6, BookStore.calculate_price([1, 2, 3, 4]) |
| 34 | + end |
| 35 | + |
| 36 | + def test_five_different_books |
| 37 | + skip |
| 38 | + assert_equal 30.0, BookStore.calculate_price([1, 2, 3, 4, 5]) |
| 39 | + end |
| 40 | + |
| 41 | + def test_two_groups_of_four_is_cheaper_than_group_of_five_plus_group_of_three |
| 42 | + skip |
| 43 | + assert_equal 51.2, BookStore.calculate_price([1, 1, 2, 2, 3, 3, 4, 5]) |
| 44 | + end |
| 45 | + |
| 46 | + def test_group_of_four_plus_group_of_two_is_cheaper_than_two_groups_of_three |
| 47 | + skip |
| 48 | + assert_equal 40.8, BookStore.calculate_price([1, 1, 2, 2, 3, 4]) |
| 49 | + end |
| 50 | + |
| 51 | + def test_two_each_of_first_4_books_and_1_copy_each_of_rest |
| 52 | + skip |
| 53 | + assert_equal 55.6, BookStore.calculate_price([1, 1, 2, 2, 3, 3, 4, 4, 5]) |
| 54 | + end |
| 55 | + |
| 56 | + def test_two_copies_of_each_book |
| 57 | + skip |
| 58 | + assert_equal 60.0, BookStore.calculate_price([1, 1, 2, 2, 3, 3, 4, 4, 5, 5]) |
| 59 | + end |
| 60 | + |
| 61 | + def test_three_copies_of_first_book_and_2_each_of_remaining |
| 62 | + skip |
| 63 | + assert_equal 68.0, BookStore.calculate_price([1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 1]) |
| 64 | + end |
| 65 | + |
| 66 | + def test_three_each_of_first_2_books_and_2_each_of_remaining_books |
| 67 | + skip |
| 68 | + assert_equal 75.2, BookStore.calculate_price([1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 1, 2]) |
| 69 | + end |
| 70 | + |
| 71 | + # Problems in exercism evolve over time, as we find better ways to ask |
| 72 | + # questions. |
| 73 | + # The version number refers to the version of the problem you solved, |
| 74 | + # not your solution. |
| 75 | + # |
| 76 | + # Define a constant named VERSION inside of the top level BookKeeping |
| 77 | + # module, which may be placed near the end of your file. |
| 78 | + # |
| 79 | + # In your file, it will look like this: |
| 80 | + # |
| 81 | + # module BookKeeping |
| 82 | + # VERSION = 1 # Where the version number matches the one in the test. |
| 83 | + # end |
| 84 | + # |
| 85 | + # If you are curious, read more about constants on RubyDoc: |
| 86 | + # http://ruby-doc.org/docs/ruby-doc-bundle/UsersGuide/rg/constants.html |
| 87 | + |
| 88 | + def test_bookkeeping |
| 89 | + skip |
| 90 | + assert_equal 0, BookKeeping::VERSION |
| 91 | + end |
| 92 | +end |
0 commit comments