tests: Update for new NativeString and Byte views
authorLucas Bajolet <r4pass@hotmail.com>
Wed, 8 Jul 2015 20:46:32 +0000 (16:46 -0400)
committerLucas Bajolet <r4pass@hotmail.com>
Thu, 9 Jul 2015 15:45:40 +0000 (11:45 -0400)
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

13 files changed:
tests/sav/nitce/test_new_native.res
tests/sav/nitce/test_new_native_alt1.res
tests/sav/nitpick_args1.res
tests/sav/test_binary.res
tests/sav/test_binary_alt1.res
tests/sav/test_binary_alt2.res
tests/sav/test_binary_alt3.res
tests/sav/test_new_native.res
tests/sav/test_new_native_alt1.res
tests/sav/test_string_bytes.res [new file with mode: 0644]
tests/test_binary.nit
tests/test_new_native.nit
tests/test_string_bytes.nit [new file with mode: 0644]

index b79b2fc..6e97e37 100644 (file)
@@ -1,6 +1,6 @@
-../lib/standard/bytes.nit:51,7--19: Documentation warning: Undocumented property `with_capacity`
-../lib/standard/bytes.nit:164,6--13: Documentation warning: Undocumented property `to_bytes`
-../lib/standard/stream.nit:425,6--17: Documentation warning: Undocumented property `buffer_reset`
+../lib/standard/bytes.nit:49,7--19: Documentation warning: Undocumented property `with_capacity`
+../lib/standard/bytes.nit:162,6--13: Documentation warning: Undocumented property `to_bytes`
+../lib/standard/stream.nit:426,6--17: Documentation warning: Undocumented property `buffer_reset`
 ../lib/standard/file.nit:455,6--19: Documentation warning: Undocumented property `read_all_bytes`
 test_advice_repeated_types.nit:36,15--20: Warning: useless type repetition on redefined attribute `_a`
 test_advice_repeated_types.nit:37,18--20: Warning: useless type repetition on parameter `b1` for redefined method `b`
index f071d47..887631f 100644 (file)
@@ -1,6 +1,6 @@
 no error
 hello
-77
+0x4d
 1.235
 1.235
 123456789
index eb0468f..832041b 100644 (file)
@@ -1,6 +1,6 @@
 no error
 hello
-77
+0x4d
 144545136640.0
 0.0
 1571011930645069824
index eb0468f..832041b 100644 (file)
@@ -1,6 +1,6 @@
 no error
 hello
-77
+0x4d
 144545136640.0
 0.0
 1571011930645069824
index f071d47..887631f 100644 (file)
@@ -1,6 +1,6 @@
 no error
 hello
-77
+0x4d
 1.235
 1.235
 123456789
index 060a759..3bc3c92 100644 (file)
@@ -1,5 +1,5 @@
 NativeString
-N
+0x4e
 Nit
 NativeArray[Int]
 3
index 209563a..7d3c3bb 100644 (file)
@@ -1,4 +1,4 @@
 Runtime error: Cast failed. Expected `E`, got `Bool` (../lib/standard/collection/array.nit:957)
 NativeString
-N
+0x4e
 Nit
diff --git a/tests/sav/test_string_bytes.res b/tests/sav/test_string_bytes.res
new file mode 100644 (file)
index 0000000..8d98756
--- /dev/null
@@ -0,0 +1,12 @@
+[0x54,0x68,0x69,0x73,0x20,0x73,0x74,0x72,0x69,0x6e,0x67,0x20,0x69,0x73,0x20,0x63,0x6f,0x6f,0x6c]
+[0x54,0x68,0x69,0x73,0x20,0x73,0x74,0x72,0x69,0x6e,0x67,0x20,0x69,0x73,0x20,0x63,0x6f,0x6f,0x6c,0x54,0x68,0x69,0x73,0x20,0x73,0x74,0x72,0x69,0x6e,0x67,0x20,0x69,0x73,0x20,0x63,0x6f,0x6f,0x6c,0x54,0x68,0x69,0x73,0x20,0x73,0x74,0x72,0x69,0x6e,0x67,0x20,0x69,0x73,0x20,0x63,0x6f,0x6f,0x6c,0x54,0x68,0x69,0x73,0x20,0x73,0x74,0x72,0x69,0x6e,0x67,0x20,0x69,0x73,0x20,0x63,0x6f,0x6f,0x6c]
+[0x54,0x68,0x69,0x73,0x20,0x73,0x74,0x72,0x69,0x6e,0x67,0x20,0x69,0x73,0x20,0x63,0x6f,0x6f,0x6c,0x54,0x68,0x69,0x73,0x20,0x73,0x74,0x72,0x69,0x6e,0x67,0x20,0x69,0x73,0x20,0x63,0x6f,0x6f,0x6c,0x54,0x68,0x69,0x73,0x20,0x73,0x74,0x72,0x69,0x6e,0x67,0x20,0x69,0x73,0x20,0x63,0x6f,0x6f,0x6c,0x54,0x68,0x69,0x73,0x20,0x73,0x74,0x72,0x69,0x6e,0x67,0x20,0x69,0x73,0x20,0x63,0x6f,0x6f,0x6c]
+[0x6c,0x6f,0x6f,0x63,0x20,0x73,0x69,0x20,0x67,0x6e,0x69,0x72,0x74,0x73,0x20,0x73,0x69,0x68,0x54]
+[0x6c,0x6f,0x6f,0x63,0x20,0x73,0x69,0x20,0x67,0x6e,0x69,0x72,0x74,0x73,0x20,0x73,0x69,0x68,0x54,0x6c,0x6f,0x6f,0x63,0x20,0x73,0x69,0x20,0x67,0x6e,0x69,0x72,0x74,0x73,0x20,0x73,0x69,0x68,0x54,0x6c,0x6f,0x6f,0x63,0x20,0x73,0x69,0x20,0x67,0x6e,0x69,0x72,0x74,0x73,0x20,0x73,0x69,0x68,0x54,0x6c,0x6f,0x6f,0x63,0x20,0x73,0x69,0x20,0x67,0x6e,0x69,0x72,0x74,0x73,0x20,0x73,0x69,0x68,0x54]
+[0x6c,0x6f,0x6f,0x63,0x20,0x73,0x69,0x20,0x67,0x6e,0x69,0x72,0x74,0x73,0x20,0x73,0x69,0x68,0x54,0x6c,0x6f,0x6f,0x63,0x20,0x73,0x69,0x20,0x67,0x6e,0x69,0x72,0x74,0x73,0x20,0x73,0x69,0x68,0x54,0x6c,0x6f,0x6f,0x63,0x20,0x73,0x69,0x20,0x67,0x6e,0x69,0x72,0x74,0x73,0x20,0x73,0x69,0x68,0x54,0x6c,0x6f,0x6f,0x63,0x20,0x73,0x69,0x20,0x67,0x6e,0x69,0x72,0x74,0x73,0x20,0x73,0x69,0x68,0x54]
+This string is cool
+This string is coolA
+Ahis string is coolA
+This string is cool
+This string is coolA
+Ahis string is coolA
index a38619b..3af2fd6 100644 (file)
@@ -19,7 +19,7 @@ var writer = new FileWriter.open(path)
 #alt1# writer.big_endian = false
 #alt3# writer.big_endian = false
 writer.write "hello"
-writer.write_byte 77
+writer.write_byte 77u8
 writer.write_float 1.23456789
 writer.write_double 1.23456789
 writer.write_int64 123456789
index c1ecc49..28facde 100644 (file)
 # limitations under the License.
 
 var s = new NativeString(4)
-s[0] = 'N'
-s[2] = 't'
-s[1] = 'i'
-s[3] = '\0'
+s[0] = 0x4Eu8
+s[2] = 0x74u8
+s[1] = 0x69u8
+s[3] = 0u8
 print s.class_name
 print s[0]
 print s.to_s
diff --git a/tests/test_string_bytes.nit b/tests/test_string_bytes.nit
new file mode 100644 (file)
index 0000000..875f5dc
--- /dev/null
@@ -0,0 +1,51 @@
+# This file is part of NIT ( http://www.nitlanguage.org ).
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+var x = "This string is cool"
+
+var y = x + x + x + x
+
+var z = x * 4
+
+print x.bytes.iterator.to_a
+print y.bytes.iterator.to_a
+print z.bytes.iterator.to_a
+
+print x.bytes.reverse_iterator.to_a
+print y.bytes.reverse_iterator.to_a
+print z.bytes.reverse_iterator.to_a
+
+var b = new FlatBuffer.from(x)
+
+print b
+
+b.bytes.add 0x41u8
+
+print b
+
+b.bytes[0] = 0x41u8
+
+print b
+
+var c = new RopeBuffer.from(x)
+
+print c
+
+c.bytes.add 0x41u8
+
+print c
+
+c.bytes[0] = 0x41u8
+
+print c