Skip to content

Commit

Permalink
Create tests for sentences with open compounds
Browse files Browse the repository at this point in the history
  • Loading branch information
tjozwik committed Sep 3, 2020
1 parent 12f0867 commit 390736f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/faker/books/test_lovecraft.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,21 @@ def test_words_with_large_count_params
assert(array.length == 250 || array.length == 500)
end

def test_sentence_with_open_compounds_allowed
1000.times do
sentence = @tester.sentence(word_count: 5, random_words_to_add: 0, open_compounds_allowed: true)
assert(sentence.split.length >= 5)
end
end

# Sentence should not contain any open compounds
def test_sentence_without_open_compounds_allowed
1000.times do
sentence = @tester.sentence(word_count: 5, random_words_to_add: 0, open_compounds_allowed: false)
assert(sentence.split.length == 5)
end
end

def test_paragraph_char_count
paragraph = @tester.paragraph_by_chars
assert(paragraph.length == 256)
Expand Down
15 changes: 15 additions & 0 deletions test/faker/default/test_faker_hipster.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,21 @@ def test_words_with_large_count_params
assert(array.length == 250 || array.length == 500)
end

def test_sentence_with_open_compounds_allowed
1000.times do
sentence = @tester.sentence(word_count: 5, random_words_to_add: 0, open_compounds_allowed: true)
assert(sentence.split.length >= 5)
end
end

# Sentence should not contain any open compounds
def test_sentence_without_open_compounds_allowed
1000.times do
sentence = @tester.sentence(word_count: 5, random_words_to_add: 0, open_compounds_allowed: false)
assert(sentence.split.length == 5)
end
end

def test_paragraph_char_count
paragraph = @tester.paragraph_by_chars(characters: 256)
assert(paragraph.length == 256)
Expand Down

0 comments on commit 390736f

Please sign in to comment.