1 lobby ensureNamespace: #UnitTests.
3 UnitTests define: #SRP &parents: {TestCase}.
5 s@(UnitTests SRP traits) equalityLiterals
7 "Literals that should compare = when replicated."
9 a: (ExtensibleArray newSize: 1).
11 a add: 999999999999999.
12 a add: -999999999999999.
17 a add: #{#name. #date}.
18 a add: ({255. 65. 66. 67. 0.} as: ByteArray).
22 s@(UnitTests SRP traits) identityLiterals
24 "Literals that should compare == when replicated."
26 { True. False. Nil. #name. $A. 7. -7.}
29 s@(UnitTests SRP traits) testLiteralDefaultReplications
31 s equalityLiterals do: [| :ea |
32 s assert: (SRP Configuration new replicate: ea) = ea.
33 s assert: (SRP NonMappingConfiguration new replicate: ea) = ea.
34 " self assert: (SrpBase64Configuration new replicate: ea) = ea.
35 self assert: (SrtSequenceCheckConfiguration new replicate: ea) = ea."
38 s identityLiterals do: [| :ea |
39 s assert: (SRP Configuration new replicate: ea) == ea.
40 s assert: ((SRP NonMappingConfiguration new replicate: ea) == ea).
41 " self assert: (SrpBase64Configuration new replicate: ea) == ea.
42 self assert: (SrtSequenceCheckConfiguration new replicate: ea) == ea."
46 s@(UnitTests SRP traits) testStringReplications
50 stream: ((ExtensibleArray newSize: 1) writer).
51 s assert: (SRP Configuration default replicate: stream contents) = stream contents.
55 s assert: (SRP Configuration default replicate: stream contents) = stream contents.
59 s assert: (SRP Configuration default replicate: stream contents) = stream contents.
63 s assert: (SRP Configuration default replicate: stream contents) = stream contents.
65 stream nextPutAll: 'ABCD'.
67 s assert: (SRP Configuration default replicate: stream contents) = stream contents.
70 stream nextPutAll: 'EFGH'.
72 s assert: (SRP Configuration default replicate: stream contents) = stream contents.
74 stream ; '\n'. stream ; '\n'.
75 stream nextPutAll: 'IJKL'.
77 s assert: (SRP Configuration default replicate: stream contents) = stream contents.
79 stream nextPut: (10 as: Character).
81 stream nextPutAll: 'MNOP'.
83 s assert: (SRP Configuration default replicate: stream contents) = stream contents.
85 stream nextPut: (13 as: Character).
88 stream nextPutAll: 'QRST'.
90 s assert: (SRP Configuration default replicate: stream contents) = stream contents.
92 stream nextPut: (13 as: Character). stream nextPut: (13 as: Character). stream ; '\n'. stream nextPutAll: 'UVW'.
94 s assert: (SRP Configuration default replicate: stream contents) = stream contents.
96 stream nextPut: (10 as: Character). stream nextPut: (10 as: Character). stream ; '\n'. stream nextPutAll: 'XYZ'.
98 s assert: (SRP Configuration default replicate: stream contents) = stream contents.
100 stream ; '\n\n\t\n\n'.
102 s assert: (SRP Configuration default replicate: stream contents) = stream contents.
106 s@(UnitTests SRP traits) testSrpDefaultsComplexObject100xWriteRead
108 | ostream method t1 t2 |
110 method: s complexObject.
112 ostream: SRP Configuration new newStream.
118 ostream nextPut: method.
119 " t1 := t1 + (self portal millisecondsToRun: [ostream nextPut: method ]).
123 " t2 := t2 + (self portal millisecondsToRun: [ostream next ]).
129 self reportComment: #testSrpDefaultsComplexObject100xWriteRead, ' save ', t1 printString, 'ms, load ', t2 printString, 'ms.'.
133 s@(UnitTests SRP traits) complexObject
135 SRP Configuration default loadObjectFromBinaryFilename: '/home/jewel/complexObject'
138 s@(UnitTests SRP traits) suite
139 [s suiteForSelectors: {
140 #testLiteralDefaultReplications.
141 #testStringReplications.
144 "UnitTests SRP suite run"