Skip to content
Snippets Groups Projects
Commit 111a0682 authored by Zhaolin Deng's avatar Zhaolin Deng
Browse files

zhaolind984027

parents
No related branches found
No related tags found
No related merge requests found
Showing
with 151 additions and 0 deletions
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
.project 0 → 100644
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>zhaolind984027</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8
File added
# SWEN90006-A1-2018
Assignment code for SWEN90006 (Software Testing and Reliability) at the University of Melbourne. Semester 2, 2018.
The folder structure is:
- src/ contains the source code for the virtual machine.
- test/ contains the templates for the JUnit test scripts.
- mutants/ contains five identical copies of the src, which you must modify to create your mutants.
- examples/ contains two example programs using the simple language.
- build.xml is an ant build script that you can choose to use or not
File added
File added
File added
File added
File added
<project name="Project" default="classes">
<target name="classes">
<mkdir dir="classes" />
<javac srcdir="src:test" destdir="classes"
classpath="lib/junit-4.11.jar;lib/hamcrest-core-1.3.jar"
includeantruntime="false"/>
</target>
<target name="clean">
<delete dir="classes" />
</target>
<target name="run" depends="classes">
<java classname="swen90006.machine.SimpleDriver"
classpath="classes/;lib/junit-4.11.jar;lib/hamcrest-core-1.3.jar">
</java>
</target>
<target name="partitioning" depends="classes">
<junit printsummary="yes" fork="yes" haltonfailure="yes">
<classpath>
<pathelement path="classes/"/>
<pathelement path="lib/junit-4.11.jar"/>
<pathelement path="lib/hamcrest-core-1.3.jar"/>
</classpath>
<formatter type="plain"/>
<test name="swen90006.machine.PartitioningTests"/>
</junit>
</target>
<target name="boundary" depends="classes">
<junit printsummary="yes" fork="yes" haltonfailure="yes">
<classpath>
<pathelement path="classes/"/>
<pathelement path="lib/junit-4.11.jar"/>
<pathelement path="lib/hamcrest-core-1.3.jar"/>
</classpath>
<formatter type="plain"/>
<test name="swen90006.machine.BoundaryTests"/>
</junit>
</target>
</project>
File added
File added
File added
File added
File added
File added
File added
;; array program. Fills an array with the values 0 ... N-1
;; and then interates through the array, summing its elements
;; global constants:
;; R3 holds 'N', the length of the array
;; R2 holds 1, the increment value used below
MOV R3 10 ; N = 10
MOV R2 1 ;
;; create the array
;; local variables
;; R1 holds 'i', which is a counter from 0 .. N-1
;; R0 holds 'p', the address of the array's ith element
MOV R1 0 ; i = 0;
MOV R0 100
SUB R4 R3 R1 ; while(i != N)
JZ R4 5 ; {
STR R0 0 R1 ; *p = i;
ADD R1 R1 R2 ; i = i + 1;
ADD R0 R0 R2 ; p = p + 1;
JMP -5 ; }
;; sum up the array
;; local variables
;; R1 holds 'i', which is a counter from 0 .. N-1
;; R0 holds 'p', the address of the array's ith element
;; R5 holds 'sum', which always holds the sum of the array's first i elements
MOV R1 0 ; i = 0;
MOV R0 100
MOV R5 0 ; sum = 0;
SUB R4 R3 R1 ; while(i != N)
JZ R4 6 ; {
LDR R4 R0 0 ;
ADD R5 R5 R4 ; sum = sum + *p;
ADD R0 R0 R2 ; p = p + 1;
ADD R1 R1 R2 ; i = i + 1;
JMP -6 ; }
RET R5 ; return sum;
\ No newline at end of file
;; factorial program, to calculate N!
;; global constants:
;; R3 holds 'N', the thing we are computing factorial of
;; R2 holds 1, the increment value used below
MOV R3 12 ; N = 12
MOV R2 1 ;
;; local variables
;; R1 holds 'i', which is a counter from 0 .. N
;; R0 holds 'n', which is always equal to i!
MOV R1 0 ; i = 0;
MOV R0 1 ; n = 1;
;; program body
;; loop invariant (see SWEN90010 next semester): n = i!
SUB R4 R3 R1 ; while(i != N)
JZ R4 4 ; {
ADD R1 R1 R2 ; i = i + 1;
MUL R0 R0 R1 ; n = n * i;
JMP -4 ; }
RET R0 ; return n;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment