Commit 2a95bfe1 authored by Lars Schieffer's avatar Lars Schieffer
Browse files

update tests

parent 62e5b4ac
......@@ -35,7 +35,7 @@ else:
print(error)
sys.exit(1)
except JANI2PINSError as error:
print(errorFormat.format(type="Error:", message=error.message))
print(errorFormat.format(type="Error:", message=str(error)))
sys.exit(1)
# Write Plugin to File
filesystem.writePlugin(pinsPlugin, commandline.getPINSPath())
......
......@@ -20,10 +20,7 @@ def instancesOf(model: dict, functions: dict) -> list:
"""
system = model["system"]
elements = [element["automaton"] for element in system["elements"]]
inputEnable = [
element["input-enable"] if "input-enable" in element else []
for element in system["elements"]
]
inputEnable = inputEnabledIn(system)
automataByName = {automaton["name"]: automaton for automaton in model["automata"]}
instances = []
for index, automaton in enumerate(elements):
......@@ -58,7 +55,7 @@ def instancesOf(model: dict, functions: dict) -> list:
removeLabel[index].add(label)
edges = flattenOf(edges)
for edge in edges:
updatedLabel = "{}_{}".format(result, len(updatedSyncs))
updatedLabel = str(len(updatedSyncs))
updatedVector = []
for index, entry in enumerate(syncVector):
if entry:
......@@ -75,6 +72,24 @@ def instancesOf(model: dict, functions: dict) -> list:
return instances
def inputEnabledIn(system: dict) -> list:
"""
Function Description:
Achieve input enable values of optional input-enable key in system object
Function Parameters:
system: dict
jani-model system object
"""
inputEnabled = []
for element in system["elements"]:
if "input-enable" in element:
inputEnabled.append(element["input-enable"])
else:
inputEnabled.append([])
return inputEnabled
def flattenOf(edges: list) -> list:
"""
Function Description:
......
......@@ -68,9 +68,8 @@ class TransitionGroup:
self.__label = label
self.__edges = edges
self.__guards = guards
self.__symbolic = len(edges) > 1
self.__write = self.__writeBy(self.__edges, stateVector)
self.__read = self.__readBy(self.__edges, stateVector).union(self.__write)
self.__read = self.__readBy(self.__edges, stateVector)
def createGuardsString(self, guardPositions: dict) -> str:
"""
......@@ -179,9 +178,6 @@ class TransitionGroup:
def getGuards(self):
return self.__guards
def isSymbolic(self):
return self.__symbolic
def getWriteDependencies(self):
return self.__write
......@@ -260,28 +256,29 @@ class TransitionGroup:
if mode == StateVectorMode.R2W:
readStateVector = stateVector.getShiftedStateVector(self.__read)
groupCode += self.__declareVariablesCode(
self.__write, readStateVector, modelLocations, readIndex=0
self.__write, readStateVector, modelLocations, readIndex=1
)
else:
groupCode += self.__declareVariablesCode(
self.__write, stateVector, modelLocations, readIndex=0
self.__write, stateVector, modelLocations, readIndex=1
)
groupCode += self.__declareTransientCode(occurringTransients, readIndex=0)
groupCode += self.__declareTransientCode(occurringTransients, readIndex=1)
for changeIndex, index in enumerate(sorted(stateVectorChanges)):
groupCode += self.__declareVariablesCode(
self.__write, readIndex=changeIndex + 1
)
groupCode += self.__declareTransientCode(
occurringTransients, readIndex=changeIndex + 1
)
for condition, change in stateVectorChanges[index]:
enableCondition = self.__edgeEnableCondition(
condition, stateVector, modelLocations, mode
if changeIndex > 0:
groupCode += self.__declareVariablesCode(
self.__write, readIndex=changeIndex + 1
)
groupCode += self.__declareTransientCode(
occurringTransients, readIndex=changeIndex + 1
)
for condition, change in stateVectorChanges[index]:
if mode == StateVectorMode.R2W:
onlyReadStateVectorR2W = readStateVector.getShiftedStateVector(
onlyRead, haltShift=True
)
if changeIndex == 0:
onlyReadStateVectorR2W = readStateVector
else:
onlyReadStateVectorR2W = readStateVector.getShiftedStateVector(
onlyRead, haltShift=True
)
writeStateVector = stateVector.getShiftedStateVector(self.__write)
edgeChange = self.__changeCode(
change,
......@@ -291,9 +288,12 @@ class TransitionGroup:
changeIndex,
)
elif mode == StateVectorMode.LONG:
onlyReadStateVectorLong = stateVector.getShiftedStateVector(
onlyRead, haltShift=True
)
if changeIndex == 0:
onlyReadStateVectorLong = stateVector
else:
onlyReadStateVectorLong = stateVector.getShiftedStateVector(
onlyRead, haltShift=True
)
edgeChange = self.__changeCode(
change,
onlyReadStateVectorLong,
......@@ -301,11 +301,7 @@ class TransitionGroup:
modelLocations,
changeIndex,
)
groupCode += [
self.__indent + enableCondition,
2 * self.__indent + edgeChange,
self.__indent + "}",
]
groupCode.append(self.__indent + edgeChange)
return groupCode, len(stateVectorChanges.keys())
......@@ -407,12 +403,15 @@ class TransitionGroup:
declaredVariables = []
for slot in sorted(list(slotNames)):
identifier = string.perform(expression=slot)
if readIndex > 0:
if readIndex > 1:
value = string.perform(
slot, modelLocations, stateVector, readIndex=str(readIndex - 1)
slot, modelLocations, stateVector, str(readIndex - 1)
)
else:
value = string.perform(slot, modelLocations, stateVector)
if identifier in stateVector.getNames():
value = string.perform(slot, modelLocations, stateVector)
else:
value = "0"
slotVariableCode = variableDeclareString.format(
identifier, str(readIndex), value
)
......@@ -432,7 +431,7 @@ class TransitionGroup:
"""
declaredTransient = []
for transient in sorted(transientIdentifiers):
if readIndex > 0:
if readIndex > 1:
identifier = "transient_" + transient
transientCode = variableDeclareString.format(
identifier, readIndex, identifier + str(readIndex - 1)
......
#include <jani2pinsPlugin.h>
// Read dependencies to state vector
int readMatrix[30][23] = {{1,0,1,0,0,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,1},{1,1,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,1},{1,1,0,0,0,1,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,1},{1,1,0,0,0,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,1},{1,1,0,0,0,1,0,0,0,0,1,0,1,1,0,0,0,0,0,0,0,0,1},{1,1,0,0,0,1,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,1},{1,1,0,0,0,1,0,0,0,0,1,0,1,1,1,0,0,0,0,0,0,0,1},{1,1,0,0,0,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,1},{1,1,0,0,0,1,0,0,0,0,1,0,0,1,1,0,0,0,0,0,0,0,1},{1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},{1,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1},{0,1,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0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0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1},{0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,1},{0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,0,0,0,1},{0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,0,0,0,1},{0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,0,0,0,1}};
int *readDependencies(int group){
return readMatrix[group];
}
......
#include <jani2pinsPlugin.h>
// Read dependencies to state vector
int readMatrix[29][8] = {{1,0,1,0,0,0,0,0},{1,0,0,0,1,0,0,0},{1,1,0,1,0,0,0,0},{1,1,0,1,0,0,0,0},{1,0,0,0,0,1,0,0},{1,1,0,1,0,0,0,0},{1,1,0,1,0,0,0,0},{1,0,0,0,0,0,1,0},{1,1,0,1,0,0,0,0},{1,1,0,1,0,0,0,0},{1,0,0,0,0,0,0,1},{1,1,0,1,0,0,0,0},{1,1,0,1,0,0,0,0},{1,1,0,1,0,0,0,0},{1,1,0,1,0,0,0,0},{1,0,0,0,0,0,0,0},{1,1,0,0,0,0,0,0},{1,1,0,0,0,0,0,0},{1,1,0,0,0,0,0,0},{1,1,0,0,0,0,0,0},{1,1,0,0,0,0,0,0},{1,0,0,1,0,0,0,0},{1,0,0,1,0,0,0,0},{1,0,0,1,0,0,0,0},{1,0,0,1,0,0,0,0},{1,0,0,1,0,0,0,0},{1,0,0,0,0,0,0,0},{1,0,1,0,1,1,1,1},{1,0,1,0,1,1,1,1}};
int readMatrix[29][8] = {{1,0,0,0,0,0,0,0},{1,0,0,0,0,0,0,0},{1,1,0,1,0,0,0,0},{1,1,0,1,0,0,0,0},{1,0,0,0,0,0,0,0},{1,1,0,1,0,0,0,0},{1,1,0,1,0,0,0,0},{1,0,0,0,0,0,0,0},{1,1,0,1,0,0,0,0},{1,1,0,1,0,0,0,0},{1,0,0,0,0,0,0,0},{1,1,0,1,0,0,0,0},{1,1,0,1,0,0,0,0},{1,1,0,1,0,0,0,0},{1,1,0,1,0,0,0,0},{1,0,0,0,0,0,0,0},{1,0,0,0,0,0,0,0},{1,0,0,0,0,0,0,0},{1,0,0,0,0,0,0,0},{1,0,0,0,0,0,0,0},{1,0,0,0,0,0,0,0},{1,0,0,0,0,0,0,0},{1,0,0,0,0,0,0,0},{1,0,0,0,0,0,0,0},{1,0,0,0,0,0,0,0},{1,0,0,0,0,0,0,0},{1,0,0,0,0,0,0,0},{1,0,1,0,1,1,1,1},{1,0,1,0,1,1,1,1}};
int *readDependencies(int group){
return readMatrix[group];
}
......
This source diff could not be displayed because it is too large. You can view the blob instead.
#include <jani2pinsPlugin.h>
// Read dependencies to state vector
int readMatrix[139][17] = {{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},{1,1,1,1,1,1,0,0,0,1,0,0,0,1,0,0,0},{0,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1},{0,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1},{0,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1},{0,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1},{0,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1},{0,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1},{0,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1},{0,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1},{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},{1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1},{1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1},{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},{1,1,1,1,1,1,1,1,1,1,1,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,1,1,1,1,1,1,1,1,1,1,1,1},{1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1},{1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1},{1,1,1,1,1,1,1,0,1,1,1,0,1,1,1,1,1},{1,1,1,1,1,1,1,0,1,1,1,0,1,1,1,1,1},{1,1,1,1,1,1,1,0,1,1,0,0,1,1,1,1,1},{1,1,1,1,1,1,1,0,1,1,0,0,1,1,1,1,1},{1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1},{1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1},{1,1,1,1,1,1,1,1,1,1,1,0,1,1,0,1,1},{1,1,1,1,1,1,1,1,1,1,1,0,1,1,0,1,1},{1,1,1,1,1,1,1,0,1,1,1,0,1,1,0,1,1},{1,1,1,1,1,1,1,0,1,1,1,0,1,1,0,1,1},{1,1,1,1,1,1,1,0,1,1,0,0,1,1,0,1,1},{1,1,1,1,1,1,1,0,1,1,0,0,1,1,0,1,1},{1,1,1,1,1,1,1,1,1,1,1,0,1,1,0,1,1},{1,1,1,1,1,1,1,1,1,1,1,0,1,1,0,1,1},{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},{1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1},{1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1},{1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,1,1},{1,1,1,1,1,1,1,0,1,1,0,1,1,1,1,1,1},{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},{1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},{1,1,1,1,0,1,0,0,1,1,0,0,1,1,0,0,1}};
int *readDependencies(int group){
return readMatrix[group];
}
......
#include <jani2pinsPlugin.h>
// Read dependencies to state vector
int readMatrix[2][3] = {{1,0,1},{1,1,1}};
int readMatrix[2][3] = {{1,0,1},{1,0,1}};
int *readDependencies(int group){
return readMatrix[group];
}
......
......@@ -25,16 +25,10 @@ int nextStateLong(model_t model, int group, int *sourceStateVector, TransitionCB
actionLabel[0] = 0;
int targetStateVector[STATEVECTORLENGTH];
memcpy(targetStateVector, sourceStateVector, STATEVECTORLENGTH * sizeof(int));
int One_instance_00 = sourceStateVector[0];
int count0 = sourceStateVector[2];
int One_instance_01 = One_instance_00;
int count1 = count0;
if ((sourceStateVector[0] == 0) && ((remEuc(sourceStateVector[2],3)) != 2)){
One_instance_01 = 0;
}
if ((sourceStateVector[0] == 0) && ((remEuc(sourceStateVector[2],3)) != 2)){
count1 = (count0 - 1);
}
int One_instance_01 = sourceStateVector[0];
int count1 = sourceStateVector[2];
One_instance_01 = 0;
count1 = (sourceStateVector[2] - 1);
targetStateVector[0] = One_instance_01;
targetStateVector[2] = count1;
int copy[STATEVECTORLENGTH] = {0,1,0};
......@@ -45,16 +39,10 @@ int nextStateLong(model_t model, int group, int *sourceStateVector, TransitionCB
actionLabel[0] = 0;
int targetStateVector[STATEVECTORLENGTH];
memcpy(targetStateVector, sourceStateVector, STATEVECTORLENGTH * sizeof(int));
int One_instance_00 = sourceStateVector[0];
int term0 = sourceStateVector[1];
int One_instance_01 = One_instance_00;
int term1 = term0;
if ((sourceStateVector[0] == 0) && ((remEuc(sourceStateVector[2],3)) == 2)){
One_instance_01 = 1;
}
if ((sourceStateVector[0] == 0) && ((remEuc(sourceStateVector[2],3)) == 2)){
term1 = 1;
}
int One_instance_01 = sourceStateVector[0];
int term1 = sourceStateVector[1];
One_instance_01 = 1;
term1 = 1;
targetStateVector[0] = One_instance_01;
targetStateVector[1] = term1;
int copy[STATEVECTORLENGTH] = {0,0,1};
......@@ -72,34 +60,22 @@ int nextStateR2W(model_t model, int group, int *sourceStateVector, TransitionCB
if (group == 0 && ((sourceStateVector[0] == 0) && ((remEuc(sourceStateVector[1],3)) != 2))){
actionLabel[0] = 0;
int targetStateVector[dm_ones_in_row(GBgetDMInfoMustWrite(model), group)];
int One_instance_00 = sourceStateVector[0];
int count0 = sourceStateVector[1];
int One_instance_01 = One_instance_00;
int count1 = count0;
if ((sourceStateVector[0] == 0) && ((remEuc(sourceStateVector[1],3)) != 2)){
One_instance_01 = 0;
}
if ((sourceStateVector[0] == 0) && ((remEuc(sourceStateVector[1],3)) != 2)){
count1 = (count0 - 1);
}
int One_instance_01 = sourceStateVector[0];
int count1 = sourceStateVector[1];
One_instance_01 = 0;
count1 = (sourceStateVector[1] - 1);
targetStateVector[0] = One_instance_01;
targetStateVector[1] = count1;
callback(context, &transitionInformation, targetStateVector, NULL);
return 1;
}
if (group == 1 && ((sourceStateVector[0] == 0) && ((remEuc(sourceStateVector[2],3)) == 2))){
if (group == 1 && ((sourceStateVector[0] == 0) && ((remEuc(sourceStateVector[1],3)) == 2))){
actionLabel[0] = 0;
int targetStateVector[dm_ones_in_row(GBgetDMInfoMustWrite(model), group)];
int One_instance_00 = sourceStateVector[0];
int term0 = sourceStateVector[1];
int One_instance_01 = One_instance_00;
int term1 = term0;
if ((sourceStateVector[0] == 0) && ((remEuc(sourceStateVector[2],3)) == 2)){
One_instance_01 = 1;
}
if ((sourceStateVector[0] == 0) && ((remEuc(sourceStateVector[2],3)) == 2)){
term1 = 1;
}
int One_instance_01 = sourceStateVector[0];
int term1 = 0;
One_instance_01 = 1;
term1 = 1;
targetStateVector[0] = One_instance_01;
targetStateVector[1] = term1;
callback(context, &transitionInformation, targetStateVector, NULL);
......@@ -116,16 +92,10 @@ int actionsR2W(model_t model, int group, int *sourceStateVector, TransitionCB ca
if (group == 0){
actionLabel[0] = 0;
int targetStateVector[dm_ones_in_row(GBgetDMInfoMustWrite(model), group)];
int One_instance_00 = sourceStateVector[0];
int count0 = sourceStateVector[1];
int One_instance_01 = One_instance_00;
int count1 = count0;
if ((sourceStateVector[0] == 0) && ((remEuc(sourceStateVector[1],3)) != 2)){
One_instance_01 = 0;
}
if ((sourceStateVector[0] == 0) && ((remEuc(sourceStateVector[1],3)) != 2)){
count1 = (count0 - 1);
}
int One_instance_01 = sourceStateVector[0];
int count1 = sourceStateVector[1];
One_instance_01 = 0;
count1 = (sourceStateVector[1] - 1);
targetStateVector[0] = One_instance_01;
targetStateVector[1] = count1;
callback(context, &transitionInformation, targetStateVector, NULL);
......@@ -134,16 +104,10 @@ int actionsR2W(model_t model, int group, int *sourceStateVector, TransitionCB ca
if (group == 1){
actionLabel[0] = 0;
int targetStateVector[dm_ones_in_row(GBgetDMInfoMustWrite(model), group)];
int One_instance_00 = sourceStateVector[0];
int term0 = sourceStateVector[1];
int One_instance_01 = One_instance_00;
int term1 = term0;
if ((sourceStateVector[0] == 0) && ((remEuc(sourceStateVector[2],3)) == 2)){
One_instance_01 = 1;
}
if ((sourceStateVector[0] == 0) && ((remEuc(sourceStateVector[2],3)) == 2)){
term1 = 1;
}
int One_instance_01 = sourceStateVector[0];
int term1 = 0;
One_instance_01 = 1;
term1 = 1;
targetStateVector[0] = One_instance_01;
targetStateVector[1] = term1;
callback(context, &transitionInformation, targetStateVector, NULL);
......