-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MathNotaiton] Decode unsafe names of Z3Sorts
- Loading branch information
Showing
7 changed files
with
97 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
Class { | ||
#name : #UnsafeZ3NameTest, | ||
#superclass : #TestCaseWithZ3Context, | ||
#category : #'MathNotation-Tests' | ||
} | ||
|
||
{ #category : #tests } | ||
UnsafeZ3NameTest >> testIntName [ | ||
| Z | | ||
Z := Int sort. | ||
self assert: Z name isZ3Symbol. | ||
self assert: Z name isStringSymbol. | ||
self deny: Z name isIntSymbol. | ||
self assert: Z name getString equals: 'Int' "NB: NOT 'ℤ'!!!" | ||
|
||
] | ||
|
||
{ #category : #tests } | ||
UnsafeZ3NameTest >> testUnsafeEnum [ | ||
| fruit consts testers | | ||
consts := Cell new. | ||
testers := Cell new. | ||
fruit := Z3DatatypeSort | ||
mkEnumerationSort: 'rotten#fruit' encodeUnsafe | ||
elements: { 'apple'. 'banana'. 'orange' } | ||
consts: consts | ||
testers: testers. | ||
self assert: fruit name isZ3Symbol. | ||
self assert: fruit name isStringSymbol. | ||
self deny: fruit name isIntSymbol. | ||
self assert: fruit name getString equals: 'rottenß35ßfruit'. | ||
self assert: fruit unsafeName equals: 'rotten#fruit' | ||
|
||
] | ||
|
||
{ #category : #tests } | ||
UnsafeZ3NameTest >> testUnsafeUninterpreted [ | ||
| s | | ||
s := Z3Sort uninterpretedSortNamed: '(a b)' encodeUnsafe. | ||
self assert: s name isZ3Symbol. | ||
self assert: s name isStringSymbol. | ||
self deny: s name isIntSymbol. | ||
self assert: s name getString equals: 'ß40ßaß32ßbß41ß'. | ||
self assert: s unsafeName equals: '(a b)' | ||
|
||
] | ||
|
||
{ #category : #tests } | ||
UnsafeZ3NameTest >> testZahlenForInt [ | ||
| Z | | ||
Z := Int sort. | ||
self assert: Z unsafeName equals: 'ℤ' | ||
|
||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Extension { #name : #Z3DatatypeSort } | ||
|
||
{ #category : #'*MathNotation' } | ||
Z3DatatypeSort >> printString [ | ||
^self unsafeName | ||
] | ||
|
||
{ #category : #'*MathNotation' } | ||
Z3DatatypeSort >> unsafeName [ | ||
^self name getString decodeUnsafe | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Extension { #name : #Z3RealSort } | ||
|
||
{ #category : #'*MathNotation' } | ||
Z3RealSort >> printString [ | ||
^self unsafeName | ||
] | ||
|
||
{ #category : #'*MathNotation' } | ||
Z3RealSort >> unsafeName [ | ||
^String with: Character reals | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Extension { #name : #Z3UninterpretedSort } | ||
|
||
{ #category : #'*MathNotation' } | ||
Z3UninterpretedSort >> printOn: aStream [ | ||
aStream nextPutAll: self unsafeName | ||
] | ||
|
||
{ #category : #'*MathNotation' } | ||
Z3UninterpretedSort >> unsafeName [ | ||
^self name asString decodeUnsafe | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters