Class: ADSP::Test::String
- Inherits:
-
Minitest::Test
- Object
- Minitest::Test
- ADSP::Test::String
- Defined in:
- lib/adsp/test/string.rb
Overview
ADSP::Test::String class.
Constant Summary collapse
- Target =
Mock::String
- Option =
Test::Option
- TEXTS =
Common::TEXTS
- LARGE_TEXTS =
Common::LARGE_TEXTS
- BUFFER_LENGTH_NAMES =
%i[destination_buffer_length].freeze
- BUFFER_LENGTH_MAPPING =
{ :destination_buffer_length => :destination_buffer_length }.freeze
Instance Method Summary collapse
- #get_compatible_decompressor_options(compressor_options, &block) ⇒ Object
-
#get_invalid_compressor_options(&block) ⇒ Object
—–.
- #get_invalid_decompressor_options(&block) ⇒ Object
- #parallel_compressor_options(&block) ⇒ Object
- #test_invalid_arguments ⇒ Object
- #test_large_texts ⇒ Object
- #test_texts ⇒ Object
Instance Method Details
#get_compatible_decompressor_options(compressor_options, &block) ⇒ Object
90 91 92 |
# File 'lib/adsp/test/string.rb', line 90 def (, &block) option. , BUFFER_LENGTH_MAPPING, &block end |
#get_invalid_compressor_options(&block) ⇒ Object
78 79 80 |
# File 'lib/adsp/test/string.rb', line 78 def (&block) option. BUFFER_LENGTH_NAMES, &block end |
#get_invalid_decompressor_options(&block) ⇒ Object
82 83 84 |
# File 'lib/adsp/test/string.rb', line 82 def (&block) option. BUFFER_LENGTH_NAMES, &block end |
#parallel_compressor_options(&block) ⇒ Object
86 87 88 |
# File 'lib/adsp/test/string.rb', line 86 def (&block) Common. option.(BUFFER_LENGTH_NAMES), &block end |
#test_invalid_arguments ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/adsp/test/string.rb', line 26 def test_invalid_arguments Validation::INVALID_STRINGS.each do |invalid_string| assert_raises ValidateError do target.compress invalid_string end assert_raises ValidateError do target.decompress invalid_string end end do || assert_raises ValidateError do target.compress "", end end do || assert_raises ValidateError do target.decompress "", end end end |
#test_large_texts ⇒ Object
65 66 67 68 69 70 71 72 73 74 |
# File 'lib/adsp/test/string.rb', line 65 def test_large_texts Common.parallel LARGE_TEXTS do |text| compressed_text = target.compress text decompressed_text = target.decompress compressed_text decompressed_text.force_encoding text.encoding assert_equal text, decompressed_text end end |
#test_texts ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/adsp/test/string.rb', line 50 def test_texts do || TEXTS.each do |text| compressed_text = target.compress text, do || decompressed_text = target.decompress compressed_text, decompressed_text.force_encoding text.encoding assert_equal text, decompressed_text end end end end |