Merge: doc: fixed some typos and other misc. corrections
[nit.git] / tests / test_new_native.nit
1 # This file is part of NIT ( http://www.nitlanguage.org ).
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 var s = new CString(4)
16 s[0] = 0x4E
17 s[2] = 0x74
18 s[1] = 0x69
19 s[3] = 0
20 print s.class_name
21 print s[0]
22 print s.to_s
23
24 var a: NativeArray[Object] = new NativeArray[Int](3)
25 a[0] = 1
26 a[1] = 10
27 a[2] = 100
28 #alt1#a[1] = true
29 print a.class_name
30 print a.length
31 print a[0]
32 print a.to_a.join(",")
33
34 var i
35 i = 3
36 a = new NativeArray[Int](i)
37 i = 1
38 a[i] = i
39 print a[i]
40 print a[1]