summaryrefslogtreecommitdiffstats
path: root/test/cbot/scenarios/TESTALL.txt
blob: 82247a0feaec2b798a6b8067f7776ed91202ae5c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
int T ( int z )
{
	return 45 + z ;
}

class	toto
{
	int	val = 3 ;
	int	x = 3 * 3 ;
	void	toto( int n )
			{ val = n + 3 ; }
	int retval ( int param )
			{ int r = val + param + x ;
			  val = param ;
			  return r ; }
}

public extern void object :: Chose( ) 
{
	int	z [ 6 ];
	for ( int i = 0 ; i < 6 ; ) z [ i++ ] = 3 - i ;
	show ( z ) ;
	return;

	// test des tableaux
	int	[ ]	a [ 3 ] ;
//	a = null;
	if ( a == null ) show ( "NULL" );

	a [ 2 / 2 ] [ 2 ]= 5 ;
	int	[ ]	b ; b = a [1] ;
	b [ 0 ] = -4;
	a [ 4 / 2 ] [ 1 ]= 1 ;
	show ( a , b ) ;
	return ; 
 {
	toto	chose = new toto (5 ) ;
	toto	truc = chose ;
	show ( chose, chose.retval( 100 ) , 
			truc, truc.retval (40 ) ) ;

	return;
  }
  {
	point	A = new 
			point ( 4 * 4 , 2 ) ;
	show ( A ) ;
	return;
  }
  {
	show ( T ( 1 ) ,  T ( 3.7 ) ) ;
	return;  
  }
 
  {
	point		A ( 3, 4 ) , 
				B = A ;

	int		n = -4;
	show ( n );

	show ( A, B ) ;

	boolean	a = false;
	boolean	b = a or true;
	if ( not a and b ) ;
	return;
  }
  {
	// test try
	float	x = nan ; int z = 0 ;
	try {
//		throw ( 3 * 4 + 33 ) ;
		int zz ; goto ( 12 ) ; z = 1 ; z = 0 / 0 ; z = 2 ;
	}
	catch ( 45 + 0 * 6000 )
	{
		show( "Exception 6000", z ) ;
	}
	catch ( x == 0 ) { show( "x nul" ) ; }
	finally { show ( "fini" ) ; }
	show ( "continue" );
	return;
  }
  {
	// test des if
	int		a = 3;
	if ( a == 3 ) show ( "33");
	else		show ( "44");
	if ( a != 3 ) show ( "333");
	else		show ( "444");
	return;
  }
  {
	int		a = 0;
	// test break
un:
	while ( true )
	{
deux:
		while ( true )
		{
			a++;
			if ( a == 2 ) continue;
			if ( a == 3 ) break deux;
			show ( a ) ;
			if ( a == 5 ) break un;
		}
		show ( "DEUX" );
	}
	return;
  }
  {
	// test switch
	int	a = 0;

	switch ( a )
	{
	case 1 : show( "un" ) ; break;
	case 2 : show( "deux" ) ; // break;
	case 3 : show( "trois" ) ; break;
	case 4 : show( "quatre" ) ; // break;
	default : show( "par d�faut" ) ;
	}
	return;
  }
  {
	// test boucle while
	float	z = 3.3;
	while ( z > 0 )
	{ show ( z-- ) ; }
	return;
  }

  {
	// test boucle do
	float	y = 3.3;
	do { int x = 0; show(y); y++; } while ( y < 7 ) ;
	return;
  }
	// test boucle for
	int j = -7; show ( j );
	for ( int ii = 3, j = 31; ii < 6 ; ++ii, j = j -3 )
	{
		j = 10 * j;
		show ( ii, j );
	}
	return;
{
	// d�clarations de variables
	int	a;	int b = 3; int c = 4*b, d = 1, e;
	float	x; float y = 3.3; float z = y / 2, u = 1, v;
	boolean	t; boolean tt = true or false; boolean ttt = false, tttt = true, t5;
	string	s; string ss = "hello"; string s2 = ss + " plus", s3 = "s3", s4;

	show( b, c, d );
	show( y, z, u );
	show( tt, ttt, tttt );
	show( ss, s2, s3 );
}
}