Commit fccb50d4 authored by updjx's avatar updjx

adding more testcases

parent 1812df11
class AttributeKill {
public A objectA;
public static void main(String args[]) {
Please register or sign in to reply
A objectA = new A();
objectA.init();
objectA = null;
A objectA = new A();
//should be null (not intiateated)
  • We don't have single line comments in MiniJava. /* should be null (not initiated) */

    Edited by ufebl
Please register or sign in to reply
int a = objectA.atr;
}
}
class A {
int atr;
Please register or sign in to reply
//pseudo constructor
Please register or sign in to reply
public void init () {
atr = 2;
}
}
}
Please register or sign in to reply
\ No newline at end of file
/**
* Attribute or static
*/
class AttributeOrSystem {
public int System;
public static void main(String args[]) {
Please register or sign in to reply
A objA = new objA();
objA.init();
System.out.println(objA.atr)
Please register or sign in to reply
}
}
class A {
int atr;
Please register or sign in to reply
public void init () {
atr = 2;
}
}
class BooleanSystemPrint {
public void test (int i) {
int a = i;
Boolean a = true;
System.out.println(a);
}
}
class NoConstructedObjectCall {
public void test() {
A objA = new objA();
int b = objA.atr;
return;
}
}
class A {
int atr;
Please register or sign in to reply
public void init () {
atr = 2;
}
}
class OverwriteWithnonedecalredVariable {
String a;
Please register or sign in to reply
public void test () {
//should break here i -not present
  • /* should break here as there is no variable i present. */

Please register or sign in to reply
int a = i;
// System.out.println(a);
}
}
class String {
}
/**
* Should find out if right variable (local in method) is taken
*/
class RightVariable {
Test Test;
Please register or sign in to reply
public Test Test(Test Test) {
return Test;
}
}
class Test {
}
\ No newline at end of file
/**
* Declare void as type for variale
*/
class VoidAttribute {
public void a;
}
class WrongReturnTypeVoid {
public void a() {
//should not allow return of integer
Please register or sign in to reply
return 5;
}
}
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