Sha256: 4ec3ed117522be7a766fe5a76e0bd1f2575c8ebe27f2a2ec3d91b4c6f91c442d
Contents?: true
Size: 1.8 KB
Versions: 4
Compression:
Stored size: 1.8 KB
Contents
require 'test/unit' require 'eymiha/util/enum' module Module_test enum %w(MA1 MA2 +2 MA3 MA4 =7 MA5 MA6 3 MA7) bitwise_enum %w(MB1 MB2 +2 MB3 MB4 =7 MB5 MB6 3 MB7) end class TC_enum_module < Test::Unit::TestCase include Module_test def test_enum assert([ MA1, MA2, MA3, MA4, MA5, MA6, MA7 ] == [ 0, 1, 4, 5, 7, 8, 3 ], "enum (instance) value assignments") end end class TC_bitwise_enum_module < Test::Unit::TestCase include Module_test def test_bitwise_enum assert([ MB1, MB2, MB3, MB4, MB5, MB6, MB7 ] == [ 1, 2, 16, 32, 128, 256, 8 ], "bitwise_enum (instance) value assignment") end end class TC_enum < Test::Unit::TestCase enum %w(A1 A2 +2 A3 A4 =7 A5 A6 3 A7) def test_enum assert([ A1, A2, A3, A4, A5, A6, A7 ] == [ 0, 1, 4, 5, 7, 8, 3 ], "enum (class) value assignments") end end class TC_bitwise_enum < Test::Unit::TestCase bitwise_enum %w(B1 B2 +2 B3 B4 =7 B5 B6 3 B7) def test_bitwise_enum assert([ B1, B2, B3, B4, B5, B6, B7 ] == [ 1, 2, 16, 32, 128, 256, 8 ], "bitwise_enum (class) value assignment") end end class TC_enum_use < Test::Unit::TestCase def test_enum assert([ TC_enum::A1, TC_enum::A2, TC_enum::A3, TC_enum::A4, TC_enum::A5, TC_enum::A6, TC_enum::A7 ] == [ 0, 1, 4, 5, 7, 8, 3 ], "enum value assignments") end end class TC_bitwise_enum_use < Test::Unit::TestCase def test_bitwise_enum assert([ TC_bitwise_enum::B1, TC_bitwise_enum::B2, TC_bitwise_enum::B3, TC_bitwise_enum::B4, TC_bitwise_enum::B5, TC_bitwise_enum::B6, TC_bitwise_enum::B7 ] == [ 1, 2, 16, 32, 128, 256, 8 ], "bitwise_enum value assignment") end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
eymiha_util-1.0.2 | test/tc_enum.rb |
eymiha_util-1.0.0 | test/tc_enum.rb |
eymiha_util-1.0.1 | test/tc_enum.rb |
eymiha_util-1.0.3 | test/tc_enum.rb |