File: test_lorem_cn.rb

package info (click to toggle)
ruby-ffaker 2.23.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,776 kB
  • sloc: ruby: 12,788; makefile: 8; sh: 1
file content (54 lines) | stat: -rw-r--r-- 1,386 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# frozen_string_literal: true

require_relative 'helper'

class TestLoremCN < Test::Unit::TestCase
  include DeterministicHelper

  assert_methods_are_deterministic(
    FFaker::LoremCN,
    :paragraph, :paragraphs, :sentence, :sentences, :word, :words
  )

  def test_paragraph
    assert_greater_than_or_equal_to FFaker::LoremCN.paragraph.length, 3 * 4 * 2
  end

  def test_sentence
    assert_greater_than_or_equal_to FFaker::LoremCN.sentence.length, 4 * 2
  end

  def test_paragraphs
    assert_greater_than_or_equal_to FFaker::LoremCN.paragraphs.length, 2
  end

  def test_paragraphs_is_not_a_string_representation_of_an_array
    assert !/[\[\]]+/.match([FFaker::LoremCN.paragraphs].flatten.join(' '))
  end

  def test_paragraphs_is_an_array
    assert FFaker::LoremCN.paragraphs.instance_of?(Array)
  end

  def test_sentences
    assert_greater_than_or_equal_to FFaker::LoremCN.sentences.length, 2
  end

  def test_sentences_is_an_array
    assert FFaker::LoremCN.sentences.instance_of?(Array)
  end

  def test_sentences_via_to_s_produces_string_terminated_with_period
    string = FFaker::LoremCN.sentences.to_s
    assert string.instance_of?(String)
    assert string =~ /。$/
  end

  def test_words
    assert_greater_than_or_equal_to FFaker::LoremCN.words.length, 2
  end

  def test_word
    assert_greater_than_or_equal_to FFaker::LoremCN.word.length, 1
  end
end