File: test_array.rb

package info (click to toggle)
ruby-net-ldap 0.19.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 640 kB
  • sloc: ruby: 4,583; sh: 53; makefile: 4
file content (22 lines) | stat: -rw-r--r-- 688 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
require_relative '../../test_helper'

class TestBERArrayExtension < Test::Unit::TestCase
  def test_control_code_array
    control_codes = []
    control_codes << ['1.2.3'.to_ber, true.to_ber].to_ber_sequence
    control_codes << ['1.7.9'.to_ber, false.to_ber].to_ber_sequence
    control_codes = control_codes.to_ber_sequence
    res = [['1.2.3', true], ['1.7.9', false]].to_ber_control
    assert_equal control_codes, res
  end

  def test_wrap_array_if_not_nested
    result1 = ['1.2.3', true].to_ber_control
    result2 = [['1.2.3', true]].to_ber_control
    assert_equal result2, result1
  end

  def test_empty_string_if_empty_array
    assert_equal "", [].to_ber_control
  end
end