# # File: test-Constraints.cbs # Author: Manfred Jeusfeld, Thomas Kuehne # Created: 2023-03-01 (2023-09-18/Manfred) # ----------------------------------------------------- # Call: cbshell -v test-Constraints.cbs # This script is self-sufficient. It first defines the multi-dimensional constructs # and then the integrity constraints and then tests the positive and negative examples. # Uses the public CBserver if local CBserver is not installed. # # connect startServer -t no -u nonpersistent -e -1 # cd oHome echo "Preparing oHome module ..." tellModel "SOURCES/00-oHome.sml.txt" showAnswer why mkdir MultiDim cd MultiDim echo "Preparing MultiDim module ..." tellModel "SOURCES/01-multidim-constructs.sml.txt" showAnswer why cd MultiDim echo "Adding constraints to MultiDim module ..." tellModel "SOURCES/02-Constraints.sml.txt" showAnswer why cd MultiDim mkdir TestC1 cd TestC1 # should fail: tellModel c1-neg1.sml.txt showAnswer why # should fail: tellModel c1-neg2.sml.txt showAnswer why # should not fail: tellModel c1-pos1.sml.txt showAnswer cd MultiDim mkdir TestC1p2 cd TestC1p2 # should not fail: tellModel c1-pos2.sml.txt showAnswer cd MultiDim mkdir TestC2 cd TestC2 # should fail: tellModel c2-neg1.sml.txt showAnswer why # should not fail: tellModel c2-pos1.sml.txt showAnswer cd MultiDim mkdir TestC3a cd TestC3a # should fail: tellModel c3-neg1.sml.txt showAnswer why # should fail: tellModel c3-neg2.sml.txt showAnswer why # violates c3a! # should fail: tellModel c3-neg3.sml.txt showAnswer why # violates c3a! cd MultiDim mkdir TestC3cn1 cd TestC3cn1 # should fail: tellModel c3c-neg1.sml.txt showAnswer why showAnswer cd MultiDim mkdir TestC3c cd TestC3c # should not indicate violators via the query: tellModel c3-pos1.sml.txt showAnswer ask C3_DisjointDimensions OBJNAMES FRAME Now showAnswer cd MultiDim mkdir TestC4 cd TestC4 # should fail: tellModel c4-neg1.sml.txt showAnswer why # also violates ac2! # should fail: tellModel c4-neg3.sml.txt showAnswer why # also violates c3a and a builtin Telos constraint on specialization when all objects have potencies with the same label # should not fail: tellModel c4-pos1.sml.txt showAnswer cd MultiDim mkdir TestC5 cd TestC5 # should fail: tellModel c5-neg1.sml.txt showAnswer why # should not fail: tellModel c5-pos1.sml.txt showAnswer why #cd MultiDim #mkdir TestUnconnected #cd TestUnconnected #tellModel unconnected.sml.txt #showAnswer #why cd MultiDim mkdir TestAC2n1 cd TestAC2n1 # should fail: tellModel ac2-neg1.sml.txt showAnswer why cd MultiDim mkdir TestAC2p1 cd TestAC2p1 # should not fail: tellModel ac2-pos1.sml.txt showAnswer cd MultiDim mkdir TestAC3n1 cd TestAC3n1 # should fail: tellModel ac3-neg1.sml.txt showAnswer why cd MultiDim mkdir TestAC3p1 cd TestAC3p1 # should not fail: tellModel ac3-pos1.sml.txt showAnswer why cd MultiDim mkdir TestAC4n1 cd TestAC4n1 # should fail: tellModel ac4-neg1.sml.txt showAnswer why cd MultiDim mkdir TestAC4p0 cd TestAC4p0 # should not fail: tellModel ac4-pos0.sml.txt showAnswer why ask C3_DisjointDimensions OBJNAMES FRAME Now showAnswer cd MultiDim mkdir TestAC4p1 cd TestAC4p1 # should not fail: tellModel ac4-pos1.sml.txt showAnswer why ask C3_DisjointDimensions OBJNAMES FRAME Now showAnswer cd MultiDim mkdir Antipattern1 cd Antipattern1 # should fail: tellModel antipattern1.sml.txt showAnswer why cd MultiDim mkdir Antipattern2 cd Antipattern2 # should fail: tellModel antipattern2.sml.txt showAnswer why cd MultiDim mkdir Antipattern2a cd Antipattern2a # should fail: tellModel antipattern2a.sml.txt showAnswer why cd MultiDim mkdir Antipattern3 cd Antipattern3 # should fail: tellModel antipattern3.sml.txt showAnswer why