Skip to content
Snippets Groups Projects
Commit 62a310c9 authored by Cookiebowser's avatar Cookiebowser
Browse files

started otherConstruct tests and fixed some things

parent 8f65d230
No related branches found
No related tags found
No related merge requests found
...@@ -344,7 +344,7 @@ if <if(forall)>!<endif><predicate> { ...@@ -344,7 +344,7 @@ if <if(forall)>!<endif><predicate> {
quantified_expression(identifier, identity, useBigInteger, setType, hasCondition, conditionalPredicate, evaluation, isInteger) ::= << quantified_expression(identifier, identity, useBigInteger, setType, hasCondition, conditionalPredicate, evaluation, isInteger) ::= <<
//quantified_expression //quantified_expression
let mut <identifier> = <if(isInteger)>BInteger::new(<identity>);<else>BSet::\<<setType>\>::new(vec![]);<endif> let mut <identifier> = <if(isInteger)><identity>;<else>BSet::\<<setType>\>::new(vec![]);<endif>
<if(hasCondition)> <if(hasCondition)>
if <conditionalPredicate> { if <conditionalPredicate> {
<evaluation> <evaluation>
...@@ -543,11 +543,11 @@ let mut _ld_<name> = <identifier>.clone(); ...@@ -543,11 +543,11 @@ let mut _ld_<name> = <identifier>.clone();
>> >>
function_call_range_element(expr, leftType, rightType, arg, val) ::= << function_call_range_element(expr, leftType, rightType, arg, val) ::= <<
<expr>._override(&BRelation<if(!leftType)>::\<bobject::Dummy, bobject::Dummy><endif>::new(vec![BTuple::new(<arg>,<val>)])) <expr>._override_single(<arg>, <val>)
>> >>
function_call_nested(expr, arg, isNested) ::= << function_call_nested(expr, arg, isNested) ::= <<
<if(!isNested)><expr><else><expr>.functionCall(<arg>)<endif> <if(!isNested)><expr><else><expr>.functionCall(&<arg>)<endif>
>> >>
assignments(assignments) ::= << assignments(assignments) ::= <<
......
package de.hhu.stups.codegenerator.rust_embedded;
import de.hhu.stups.codegenerator.rust.TestRS;
import org.junit.Test;
import java.io.IOException;
import java.net.URISyntaxException;
public class TestOtherConstructs extends TestRSE {
public TestOtherConstructs() throws URISyntaxException, IOException {}
@Test
public void testWhile() throws Exception {
testRSE("While", "WhileAddition.strs");
}
@Test
public void testEquivalence() throws Exception {
testRSE("Equivalence", "EquivalenceAddition.strs");
}
@Test()
public void testBooleanPredicate() throws Exception {
testRSE("BooleanPredicate", "BooleanPredicateAddition.strs");
}
@Test
public void testBooleanPredicateWD() throws Exception {
testRSE("BooleanPredicateWD", "BooleanPredicateAdditionWD.strs");
}
@Test
public void testNondeterminism() throws Exception {
testRSE("Nondeterminism", "NondeterminismAddition.strs");
}
@Test
public void testNondeterminism2() throws Exception {
testRSE("Nondeterminism2", "Nondeterminism2Addition.strs");
}
@Test
public void testMapFunction() throws Exception {
testRSE("MapFunction", "MapFunctionAddition.strs");
}
@Test
public void testSetUnion() throws Exception {
testRSE("SetUnion", null);
}
@Test
public void testManyLocalDeclarations() throws Exception {
testRSE("ManyLocalDeclarations", "ManyLocalDeclarationsAddition.strs");
}
@Test
public void testManyLocalDeclarations2() throws Exception {
testRSE("ManyLocalDeclarations2", "ManyLocalDeclarations2Addition.strs");
}
@Test
public void testAssert() throws Exception {
testRSE("Assert", null);
}
@Test
public void testChoice() throws Exception {
testRSE("Choice", "ChoiceAddition.strs");
}
@Test
public void testDanglingElseWD() throws Exception {
testRSE("DanglingElseWD", "DanglingElseAdditionWD.strs");
}
@Test
public void testIfAndPredicates() throws Exception {
testRSE("IfAndPredicates", "IfAndPredicatesAddition.strs");
}
@Test
public void testNameCollision() throws Exception {
testRSE("NameCollision", "NameCollisionAddition.strs");
}
@Test
public void testSwap() throws Exception {
testRSE("Swap", "SwapAddition.strs");
}
@Test
public void testSwap2() throws Exception {
testRSE("Swap2", "Swap2Addition.strs");
}
@Test
public void testUnion() throws Exception {
testRSE("Union", "UnionAddition.strs");
}
@Test
public void testIfExpression() throws Exception {
testRSE("IfExpression", "IfExpressionAddition.strs");
}
@Test
public void testIfPredicate() throws Exception {
testRSE("IfPredicate", "IfPredicateAddition.strs");
}
@Test
public void testRecords() throws Exception {
testRSE("Records", null);
}
@Test
public void testRecordsAccess() throws Exception {
testRSE("RecordsAccess", null);
}
@Test
public void testRecordsAccess2() throws Exception {
testRSE("RecordsAccess2", null);
}
@Test
public void testRecordsAccess3() throws Exception {
testRSE("RecordsAccess3", "RecordsAccess3.strs");
}
@Test
public void testRecordAccessNested() throws Exception {
testRSE("RecordAccessNested", "RecordAccessNested.strs");
}
@Test
public void testRecordAccessNested2() throws Exception {
testRSE("RecordAccessNested2", "RecordAccessNested2.strs");
}
@Test
public void testRecordAccessNested3() throws Exception {
testRSE("RecordAccessNested3", "RecordAccessNested3.strs");
}
@Test
public void testFunctionCallAccessNested() throws Exception {
testRSE("FunctionCallAccessNested", "FunctionCallAccessNested.strs");
}
@Test
public void testFunctionCallAccessNested2() throws Exception {
testRSE("FunctionCallAccessNested2", "FunctionCallAccessNested2.strs");
}
@Test
public void testFunctionCallAccessNested3() throws Exception {
testRSE("FunctionCallAccessNested3", "FunctionCallAccessNested3.strs");
}
@Test
public void testFunctionCallAccessNested4() throws Exception {
testRSE("FunctionCallAccessNested4", "FunctionCallAccessNested4.strs");
}
@Test
public void testFunctionCallAccessNested5() throws Exception {
testRSE("FunctionCallAccessNested5", "FunctionCallAccessNested5.strs");
}
@Test
public void testFunctionCallAccessNested6() throws Exception {
testRSE("FunctionCallAccessNested6", "FunctionCallAccessNested6.strs");
}
@Test
public void testFunctionCallAccessNested7() throws Exception {
testRSE("FunctionCallAccessNested7", "FunctionCallAccessNested7.strs");
}
@Test
public void testDeferredSet() throws Exception {
testRSE("DeferredSet", null);
}
@Test
public void testDeferredSet2() throws Exception {
testRSE("DeferredSet2", null);
}
@Test
public void testDeferredSet3() throws Exception {
testRSE("DeferredSet3", null);
}
@Test
public void testDeferredSet4() throws Exception {
testRSE("DeferredSet4", null);
}
}
MACHINE FunctionCallAccessNested MACHINE FunctionCallAccessNested
SETS EINT = {ONE, TWO, FOUR}
VARIABLES x, y, res VARIABLES x, y, res
INVARIANT INVARIANT
x : INTEGER +-> (INTEGER +-> INTEGER) & x : EINT +-> (EINT +-> EINT) &
y : INTEGER & y : EINT &
res : INTEGER res : EINT
INITIALISATION INITIALISATION
x := {1|->{2|->3}, 2|->{3|->4}}; x := {ONE|->{TWO|->ONE}, TWO|->{FOUR|->ONE}};
y := 0; y := ONE;
res := -1 res := ONE
OPERATIONS OPERATIONS
calculate = BEGIN calculate = BEGIN
y := x(1)(2); y := x(ONE)(TWO);
x(1)(2) := 4; x(ONE)(TWO) := FOUR;
res := x(1)(2) res := x(ONE)(TWO)
END; END;
out <-- getRes = BEGIN out <-- getRes = BEGIN
......
4 FOUR
\ No newline at end of file \ No newline at end of file
fn main() { fn main() {
let mut functional = FunctionCallAccessNested::new(); let mut functional = FunctionCallAccessNested::new();
functional.calculate(); functional.calculate();
println!("{}", functional.getRes()); println!("{:?}", functional.getRes());
} }
\ No newline at end of file
fn main() { fn main() {
let mut iff = IfAndPredicates::new(); let mut iff = IfAndPredicates::new();
iff.calculate(); iff.Inc(BInteger::new(10));
println!(iff.getRes()); println!("{}", iff.getRes());
} }
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment