- Timestamp:
- Jul 9, 2020, 8:51:43 AM (4 years ago)
- Location:
- EcnlProtoTool/trunk/mruby-2.1.1
- Files:
-
- 1 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
EcnlProtoTool/trunk/mruby-2.1.1/mrbgems/mruby-inline-struct/test/inline.rb
r331 r439 18 18 assert('InlineStructTest#dup') do 19 19 obj = InlineStructTest.new(1) 20 assert_equal obj.to_s, 'fixnum (1)'21 assert_equal obj.dup.to_s, 'fixnum (1)'20 assert_equal obj.to_s, 'fixnum' 21 assert_equal obj.dup.to_s, 'fixnum' 22 22 end 23 23 24 24 assert('InlineStructTest#clone') do 25 25 obj = InlineStructTest.new(1) 26 assert_equal obj.to_s, 'fixnum (1)'27 assert_equal obj.clone.to_s, 'fixnum (1)'26 assert_equal obj.to_s, 'fixnum' 27 assert_equal obj.clone.to_s, 'fixnum' 28 28 end 29 29 … … 39 39 assert('InlineStructTest#mutate (dup)') do 40 40 obj1 = InlineStructTest.new("foo") 41 assert_equal obj1.to_s, "string (foo)"41 assert_equal obj1.to_s, "string" 42 42 obj2 = obj1.dup 43 assert_equal obj2.to_s, "string (foo)"43 assert_equal obj2.to_s, "string" 44 44 obj1.mutate 45 assert_equal obj1.to_s, "mutate (foo)"46 assert_equal obj2.to_s, "string (foo)"45 assert_equal obj1.to_s, "mutate" 46 assert_equal obj2.to_s, "string" 47 47 end 48 48 49 49 assert('InlineStructTest#mutate (clone)') do 50 50 obj1 = InlineStructTest.new("foo") 51 assert_equal obj1.to_s, "string (foo)"51 assert_equal obj1.to_s, "string" 52 52 obj2 = obj1.clone 53 assert_equal obj2.to_s, "string (foo)"53 assert_equal obj2.to_s, "string" 54 54 obj1.mutate 55 assert_equal obj1.to_s, "mutate (foo)"56 assert_equal obj2.to_s, "string (foo)"55 assert_equal obj1.to_s, "mutate" 56 assert_equal obj2.to_s, "string" 57 57 end 58 58 … … 102 102 assert_equal InlineStructTest.length, 3 * 8 103 103 end 104 105 assert('InlineStructTest w/float [64 bit]') do106 obj = InlineStructTest.new(1.25)107 assert_equal obj.to_s, "float(1.250)"108 end109 110 assert('InlineStructTest w/fixnum [64 bit]') do111 obj = InlineStructTest.new(42)112 assert_equal obj.to_s, "fixnum(42)"113 end114 115 assert('InlineStructTest w/string [64 bit]') do116 obj = InlineStructTest.new("hello")117 assert_equal obj.to_s, "string(hello)"118 end119 120 assert('InlineStructTest w/long string [64 bit]') do121 obj = InlineStructTest.new("this won't fit in 3 * 8 bytes available for the structure")122 assert_equal obj.to_s, "string(this won't fit i"123 end124 104 end 125 105 … … 129 109 assert_equal InlineStructTest.length, 3 * 4 130 110 end 111 end 131 112 132 assert('InlineStructTest w/float [32 bit]') do 133 obj = InlineStructTest.new(1.25) 134 assert_equal obj.to_s, "float(1.250" 135 end 136 137 assert('InlineStructTest w/fixnum [32 bit]') do 138 obj = InlineStructTest.new(42) 139 assert_equal obj.to_s, "fixnum(42)" 140 end 141 142 assert('InlineStructTest w/string [32 bit]') do 143 obj = InlineStructTest.new("hello") 144 assert_equal obj.to_s, "string(hell" 145 end 146 147 assert('InlineStructTest w/long string [32 bit]') do 148 obj = InlineStructTest.new("this won't fit in 3 * 4 bytes available for the structure") 149 assert_equal obj.to_s, "string(this" 113 # 16-bit mode 114 if InlineStructTest.length == 6 115 assert('InlineStructTest length [16 bit]') do 116 assert_equal InlineStructTest.length, 3 * 2 150 117 end 151 118 end
Note:
See TracChangeset
for help on using the changeset viewer.