File: bijection_test.rb

package info (click to toggle)
ruby-tins 1.32.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,248 kB
  • sloc: ruby: 6,659; makefile: 3
file content (19 lines) | stat: -rw-r--r-- 457 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
require 'test_helper'
require 'tins'

module Tins
  class BijectionTest < Test::Unit::TestCase
    def test_bijection
      assert_equal [ [ 1, 2 ], [ 3, 4 ] ], Tins::Bijection[ 1, 2, 3, 4 ].to_a.sort
      assert_raise(ArgumentError) do
        Tins::Bijection[1,2,3]
      end
      assert_raise(ArgumentError) do
        Tins::Bijection[1,2,3,2]
      end
      assert_raise(ArgumentError) do
        Tins::Bijection[1,2,1,3]
      end
    end
  end
end