Sha256: e4a4cdb572443e9f1094f0e0983b02986739763bdf49a1eb15a77e7599bf21c6

Contents?: true

Size: 1.11 KB

Versions: 28

Compression:

Stored size: 1.11 KB

Contents

require 'test_helper'

# Tests obfuscation library
class ObfuscatorTest < Minitest::Test
  test 'deterministic seed should give consistent obfuscation' do
    seed1 = 1383023878118423080153274094615300156
    assert_equal 'CE PSEQQH', NdrSupport::Obfuscator.obfuscate('JO BLOGGS', seed1)
    assert_equal 'CE PSEQQH', NdrSupport::Obfuscator.obfuscate('JO BLOGGS', seed1),
                 'consistent re-obfuscation'
    assert_equal 'CE PSEQQH', NdrSupport::Obfuscator.obfuscate('Jo Bloggs', seed1),
                 'case insensitive'
    assert_equal 'CEZG PTIQQH', NdrSupport::Obfuscator.obfuscate('JOHN BRIGGS', seed1)
  end

  test 'different seeds should obfuscate differently' do
    seed2 = 33333285080880515415022777373811069493
    assert_equal 'VI RQICCZ', NdrSupport::Obfuscator.obfuscate('JO BLOGGS', seed2)
  end

  test 'test seed setup' do
    seed3 = 24978785977027615655244702873942606627
    assert_equal '781 RACO RXHOOX', NdrSupport::Obfuscator.obfuscate('369 Some Street', seed3)
    NdrSupport::Obfuscator.setup(seed3)
    assert_equal '781 RACO RXHOOX', NdrSupport::Obfuscator.obfuscate('369 Some Street')
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
ndr_support-5.6.1 test/obfuscator_test.rb
ndr_support-5.6.0 test/obfuscator_test.rb
ndr_support-5.5.1 test/obfuscator_test.rb
ndr_support-5.5.0 test/obfuscator_test.rb
ndr_support-5.4.2 test/obfuscator_test.rb
ndr_support-5.4.1 test/obfuscator_test.rb
ndr_support-5.3.2 test/obfuscator_test.rb
ndr_support-5.3.1 test/obfuscator_test.rb