/**
 * 
 */
package test.blog;

import org.junit.Test;

import blog.Main;

/**
 * @author leili
 * @since Nov 23, 2012
 * 
 */
public class TestOperator {

	private static String[] args = { "-n", "1" };

	@Test
	public void testConstantPLus() {
		String code = "fixed Integer x = 1 + 2; \n " + "query x;";
		Main.runFromString(code, args);
	}

	@Test
	public void testConstantMult() {
		String code = "fixed Integer x = 1 * 2; \n " + "query x;";
		Main.runFromString(code, args);
	}

	@Test
	public void testConstantDiv() {
		String code = "fixed Real x = 1.0 / 2.0; \n " + "query x;";
		Main.runFromString(code, args);
	}

	@Test
	public void testConstantMinus() {
		String code = "fixed Real x = 1.0 - 2.0; \n " + "query x;";
		Main.runFromString(code, args);
	}

	@Test
	public void testVarPlus() {
		String code = "fixed Integer x = 1; fixed Integer y = 2; "
				+ "fixed Integer z = x + y; query z;";
		Main.runFromString(code, args);
	}

	@Test
	public void testMultiInFunction() {
		String code = "random Integer qstate(Integer t) {\n" + "\n"
				+ "  if t != 0 then\n" + "\n" + "    = t*2\n" + "\n" + "  else\n"
				+ "\n" + "    = 0\n" + "\n" + "};"
				+ "query qstate(2); query qstate(0);";
		Main.runFromString(code, args);
	}

}

@@ -149,17 +149,18 @@
 ator %7B%0A%0A
-%09
+  
 private 
@@ -198,24 +198,26 @@
 %221%22 %7D;%0A%0A
-%09
+  
 @Test%0A
-%09
+  
 public v
@@ -237,26 +237,28 @@
 antPLus() %7B%0A
-%09%09
+    
 String code 
@@ -296,34 +296,36 @@
 %22 + %22query x;%22;%0A
-%09%09
+    
 Main.runFromStri
@@ -336,36 +336,39 @@
 ode, args);%0A
-%09%7D%0A%0A%09
+  %7D%0A%0A  
 @Test%0A
-%09
+  
 public void 
@@ -384,26 +384,28 @@
 antMult() %7B%0A
-%09%09
+    
 String code 
@@ -443,34 +443,36 @@
 %22 + %22query x;%22;%0A
-%09%09
+    
 Main.runFromStri
@@ -483,36 +483,39 @@
 ode, args);%0A
-%09%7D%0A%0A%09
+  %7D%0A%0A  
 @Test%0A
-%09
+  
 public void 
@@ -530,26 +530,28 @@
 tantDiv() %7B%0A
-%09%09
+    
 String code 
@@ -590,34 +590,36 @@
 %22 + %22query x;%22;%0A
-%09%09
+    
 Main.runFromStri
@@ -630,36 +630,39 @@
 ode, args);%0A
-%09%7D%0A%0A%09
+  %7D%0A%0A  
 @Test%0A
-%09
+  
 public void 
@@ -679,26 +679,28 @@
 ntMinus() %7B%0A
-%09%09
+    
 String code 
@@ -743,26 +743,28 @@
 %22query x;%22;%0A
-%09%09
+    
 Main.runFrom
@@ -779,36 +779,39 @@
 ode, args);%0A
-%09%7D%0A%0A%09
+  %7D%0A%0A  
 @Test%0A
-%09
+  
 public void 
@@ -822,26 +822,28 @@
 VarPlus() %7B%0A
-%09%09
+    
 String code 
@@ -889,20 +889,24 @@
  = 2; %22%0A
-%09%09%09%09
+        
 + %22fixed
@@ -932,26 +932,28 @@
  query z;%22;%0A
-%09%09
+    
 Main.runFrom
@@ -976,20 +976,220 @@
 s);%0A
-%09%7D%0A%0A%09
+  %7D%0A%0A  
 @Test%0A
-%09
+  public void testMultiplication() %7B%0A    String code = %22fixed Real x = 1; fixed Real y = 2; %22%0A        + %22fixed Real square = x * x; query square;%22;%0A    Main.runFromString(code, args);%0A  %7D%0A%0A  @Test%0A  
 publ
@@ -1220,18 +1220,20 @@
 ion() %7B%0A
-%09%09
+    
 String c
@@ -1284,20 +1284,24 @@
  + %22%5Cn%22%0A
-%09%09%09%09
+        
 + %22  if 
@@ -1358,20 +1358,24 @@
 else%5Cn%22%0A
-%09%09%09%09
+        
 + %22%5Cn%22 +
@@ -1405,12 +1405,16 @@
 %7D;%22%0A
-%09%09%09%09
+        
 + %22q
@@ -1452,10 +1452,12 @@
 ;%22;%0A
-%09%09
+    
 Main
@@ -1488,9 +1488,10 @@
 s);%0A
-%09
+  
 %7D%0A%0A%7D

add a bit testing for operator