Sha256: 75397d1b9b5f7667cfce932fd0532b6ddd4298ecdfcd0374772f4eecf7743345

Contents?: true

Size: 1.07 KB

Versions: 9

Compression:

Stored size: 1.07 KB

Contents

# frozen_string_literal: true

require_relative 'helper'

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

  assert_methods_are_deterministic(
    FFakerTW::NatoAlphabet,
    :code, :alphabetic_code, :numeric_code, :callsign
  )

  def setup
    @tester = FFakerTW::NatoAlphabet
  end

  def test_code
    assert FFakerTW::NatoAlphabet::CODES.include?(@tester.code)
  end

  def test_letter_code
    assert FFakerTW::NatoAlphabet::ALPHABET_CODES.include?(@tester.alphabetic_code)
  end

  def test_numerify_code
    assert FFakerTW::NatoAlphabet::NUMERIC_CODES.include?(@tester.numeric_code)
  end

  def test_callsign
    assert_match(/[A-Z]+-[A-Z]+-[A-Z]+/, @tester.callsign)
  end

  def test_codify
    assert_match(/[A-Z]+-[A-Z]+-[A-Z]+/, @tester.codify('?-?-?'))
    assert_match(/[A-Z]+-[A-Z]+-[A-Z]+/, @tester.codify('?-#-?'))
    assert_match(FFakerTW::NatoAlphabet::STOP_CODE, @tester.codify('.'))

    assert_deterministic { @tester.codify('?-?-?') }
    assert_deterministic { @tester.codify('?-#-?') }
    assert_deterministic { @tester.codify('.') }
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
ffakerTW-1.8.0 test/test_nato_alphabet.rb
ffakerTW-1.7.0 test/test_nato_alphabet.rb
ffakerTW-1.6.0 test/test_nato_alphabet.rb
ffakerTW-1.5.0 test/test_nato_alphabet.rb
ffakerTW-1.4.0 test/test_nato_alphabet.rb
ffakerTW-1.3.0 test/test_nato_alphabet.rb
ffakerTW-1.2.0 test/test_nato_alphabet.rb
ffakerTW-1.1.0 test/test_nato_alphabet.rb
ffakerTW-0.1.0 test/test_nato_alphabet.rb