Unverified Commit b9d47d46 authored by uwdkn's avatar uwdkn

Exec test cases of Rust Team

parent 48c9e4a7
class A {
public static void main(String[] args) {
System.out.println(2 - 1); // 1
System.out.println(4 / 2); // 2
System.out.println(1 + 2); // 3
System.out.println(2 * 2); // 4
System.out.println(11 % 6); // 5
if (false || true) { System.out.println(6); }
if (true || false) { System.out.println(7); }
if (true && false) { } else { System.out.println(8); }
if (true && true) { System.out.println(9); }
if (1 == 1) { System.out.println(10); }
if (1 == 2) { } else { System.out.println(11); }
if (1 != 2) { System.out.println(12); }
if (1 != 1) { } else { System.out.println(13); }
if (1 < 2) { System.out.println(14); }
if (1 < 1) { } else { System.out.println(15); }
if (2 > 1) { System.out.println(16); }
if (1 > 1) { } else { System.out.println(17); }
if (1 <= 1) { System.out.println(18); }
if (2 <= 1) { } else { System.out.println(19); }
if (1 >= 1) { System.out.println(20); }
if (1 >= 2) { } else { System.out.println(21); }
}
}
1
2
3
4
5
6
7
9
10
11
12
13
14
15
16
17
18
19
20
21
class Foo {
public int ret_int() {
return 48;
}
public static void main(String[] args) {
Foo a = new Foo();
int b = a.ret_int();
System.out.println(b);
}
}
class A {
public boolean side_effect() {
System.out.write(70); //
System.out.write(10); // newline
return false;
}
public static void main(String[] args) {
A a = new A();
if (true || a.side_effect()) {
System.out.write(79); // O
System.out.write(75); // K
System.out.write(10); // newline
}
if (false && a.side_effect()) {
} else {
System.out.write(79); // O
System.out.write(75); // K
System.out.write(10); // newline
}
if (!(false && a.side_effect())) {
System.out.write(79); // O
System.out.write(75); // K
System.out.write(10); // newline
}
if ((true || a.side_effect()) && true) {
System.out.write(79); // O
System.out.write(75); // K
System.out.write(10); // newline
}
}
}
class A {
public int a;
public void print_as() {
System.out.println(a);
System.out.println(this.a);
}
public static void main(String[] args) {
A a = new A();
a.print_as();
B b = new B();
if (b.b) {
System.out.println(1);
} else {
System.out.println(0);
}
if (b.c == null) {
System.out.println(0);
} else {
System.out.println(1);
}
}
}
class B {
public boolean b;
public A c;
}
class Foo {
public static void main(String[] args) {
if (true) {
System.out.println(1);
} else {
System.out.println(0);
}
if (false) {
System.out.println(0);
} else {
System.out.println(1);
}
}
}
class A {
public static void main(String[] args) {
((System).out).println(4);
}
}
class A {
public B get_object() {
return new B();
}
public static void main(String[] args) {
A a = new A();
int res = (a.get_object()).get_number();
System.out.println(res);
}
}
class B {
public int get_number() {
return 99;
}
}
eass A {
public static void main(String[] args) {
int x = 8;
int y = x = 4;
System.out.println(x);
System.out.println(y);
}
}
class A {
public int loopy_1() {
int i = 3;
while (i < 5) { return i; }
}
public static void main(String[] args) {
System.out.println((new A()).loopy_1());
}
}
class A {
public static void main(String[] args) {
int x = 4;
System.out.println(-x);
if (!false) { System.out.println(-3); }
if (!true) { } else { System.out.println(-2); }
if (!!!true) { } else { System.out.println(-1); }
}
}
class A {
public static void main(String[] args) {
int x = 0;
boolean a = false;
while(a) { x = 1; }
System.out.println(x);
while(x < 5) { x = x + 1; }
System.out.println(x);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment