tests: adds native interface tests
[nit.git] / tests / test_ni_inits.nit.c
1 /* This file is part of NIT ( http://www.nitlanguage.org ).
2 *
3 * Copyright 2011 Alexis Laferrière <alexis.laf@xymus.net>
4 *
5 * This file is free software, which comes along with NIT. This software is
6 * distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
7 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
8 * PARTICULAR PURPOSE. You can modify it is you want, provided this header
9 * is kept unaltered, and a notification of the changes is added.
10 * You are allowed to redistribute it and sell it, alone or is a part of
11 * another product.
12 */
13
14 #include "test_ni_inits.nit.h"
15
16 /*
17 C implementation of test_ni_inits::A::with_b
18 */
19 A new_A_with_b___impl( )
20 {
21 A a = malloc( sizeof(char) );
22 *a = 'b';
23 return a;
24 }
25
26 /*
27 C implementation of test_ni_inits::A::alloc
28 */
29 A new_A_alloc___impl( )
30 {
31 A a = malloc( sizeof(char) );
32 return a;
33 }
34
35 /*
36 C implementation of test_ni_inits::A::set
37 */
38 void A_set___impl( A recv, char v )
39 {
40 *recv = 'v';
41 }
42
43 /*
44 C implementation of test_ni_inits::A::(string::Object::to_s)
45
46 Imported methods signatures:
47 String new_String_from_cstring( char * str ) for string::String::from_cstring
48 */
49 String A_to_s___impl( A recv )
50 {
51 char *str = malloc( 2 * sizeof(char) );
52 str[0] = *recv;
53 str[1] = 0;
54
55 return new_String_from_cstring( str );
56 }