Example #1
0
        public void codeGenTest_Program_ParameterIdentity()
        {
            BFTestHelper.debugProgram_Terminate(@"
			program p0 
				begin 
					id(); 
				end 

				int[8] id() 
				var 
					int[8] uv := {7,7,7,7,7,7,7,7}; 
				begin 
					return uv; 
				end 
			end
			"            );

            BFTestHelper.debugProgram_Terminate(@"
			program p0
				var 
					int[8] x;
				begin
					x = id(x);
				end
				int[8] id(int[8] input)
				begin
					return input;
				end
			end
			"            );
        }
Example #2
0
        public void codeGenTest_Program_MethodCalls()
        {
            BFTestHelper.debugProgram_Terminate(@"
			program testprog
				VAR
					int i;
				BEGIN

					OUT ''\r\nSTART\r\n'';

					ma();
					mb();
					mc();

					OUT ''\r\nFIN\r\n'';

					QUIT;
				END

				VOID ma()
				BEGIN
				
					OUT ''A1'';
					OUT ''A2'';
					OUT ''A3'';
					OUT ''\r\n'';

					RETURN;

				END

				VOID mb()
				BEGIN

					OUT ''B1'';
					OUT ''B2'';
					OUT ''B3'';
					OUT ''\r\n'';

					RETURN;

				END

				VOID mc()
				BEGIN

					OUT ''C1'';
					OUT ''C2'';
					OUT ''C3'';
					OUT ''\r\n'';

					RETURN;

				END
			END
			"            );
        }
Example #3
0
        public void codeGenTest_Program_ParameterMethodCalls()
        {
            BFTestHelper.debugProgram_Terminate(@"
			program example
				begin
					out euclid(44, 12);
				end

				int euclid(int a, int b) 
				begin
					OUT a;
					OUT ''  '';
					OUT b;
					OUT ''  '';
					return 1337;
				end
			end
			"            );
        }
Example #4
0
        public void codeGenTest_Program_recursive_calls()
        {
            BFTestHelper.debugProgram_Terminate(@"
			program example : display[0, 0]
				begin
					push(peek());
				end
	
				void push(int v)
				begin
					out ''<in_push>'';
				end

				int peek()
				begin
					out ''<in_peek>'';
					return 42;
				end
			end
			"            );
        }