1 require 'abstract_unit'
2 require 'fixtures/reference_type'
3 require 'fixtures/reference_code'
5 class CompositeArraysTest < Test::Unit::TestCase
7 def test_new_primary_keys
8 keys = CompositePrimaryKeys::CompositeKeys.new
10 assert_equal '', keys.to_s
11 assert_equal '', "#{keys}"
14 def test_initialize_primary_keys
15 keys = CompositePrimaryKeys::CompositeKeys.new([1,2,3])
17 assert_equal '1,2,3', keys.to_s
18 assert_equal '1,2,3', "#{keys}"
21 def test_to_composite_keys
22 keys = [1,2,3].to_composite_keys
23 assert_equal CompositePrimaryKeys::CompositeKeys, keys.class
24 assert_equal '1,2,3', keys.to_s
28 keys = CompositePrimaryKeys::CompositeIds.new
30 assert_equal '', keys.to_s
31 assert_equal '', "#{keys}"
34 def test_initialize_ids
35 keys = CompositePrimaryKeys::CompositeIds.new([1,2,3])
37 assert_equal '1,2,3', keys.to_s
38 assert_equal '1,2,3', "#{keys}"
41 def test_to_composite_ids
42 keys = [1,2,3].to_composite_ids
43 assert_equal CompositePrimaryKeys::CompositeIds, keys.class
44 assert_equal '1,2,3', keys.to_s
48 keys = [CompositePrimaryKeys::CompositeIds.new([1,2,3]), CompositePrimaryKeys::CompositeIds.new([4,5,6])]
49 assert_equal 6, keys.flatten.size