@@ -193,20 +193,44 @@ GtRemoteGemStoneWireEncodingExamples >> passAndRetrieveFloat [
193193 For GT / Pharo 13 and GemStone 3.7.5 GtWireFloatPrintStringEncoder matches exactly."
194194 < gtExample>
195195 < return: #AssertionFailure >
196- | session result |
196+ | session values result |
197197
198198 session := self runningServer.
199199
200- (session hasFeatureNamed: #floatStringEncoding ) ifFalse: [ ^ self ].
201-
202- result := session evaluateBlockAndWait: [ :in |
203- in = Float pi ifFalse:
204- [ nil error: ' in=' , in asString ].
205- Float pi ]
206- withArguments: { Float pi }
200+ values := {
201+ Float zero.
202+ Float pi.
203+ Float negativeZero.
204+ Float infinity.
205+ 1.0 .
206+ - 1.0 .
207+ 0.1 .
208+ - 0.1 .
209+ }.
210+
211+ result := session evaluateBlockAndWait: [ :array :infinity |
212+ (array at: 1 ) = 0.0 ifFalse:
213+ [ nil error: ' Not zero: ' , (array at: 1 ) asString ].
214+ (array at: 2 ) = Float pi ifFalse:
215+ [ nil error: ' Not pi: ' , (array at: 2 ) asString ].
216+ (array at: 3 ) = - 0.0 ifFalse:
217+ [ nil error: ' Not negative zero: ' , (array at: 3 ) asString ].
218+ (array at: 4 ) = infinity ifFalse:
219+ [ nil error: ' Not infinity: ' , (array at: 4 ) asString ].
220+ (array at: 5 ) = 1.0 ifFalse:
221+ [ nil error: ' Not one: ' , (array at: 5 ) asString ].
222+ (array at: 6 ) = - 1.0 ifFalse:
223+ [ nil error: ' Not minus one: ' , (array at: 6 ) asString ].
224+ (array at: 7 ) = 0.1 ifFalse:
225+ [ nil error: ' Not 0.1: ' , (array at: 7 ) asString ].
226+ (array at: 8 ) = - 0.1 ifFalse:
227+ [ nil error: ' Not -0.1: ' , (array at: 8 ) asString ].
228+ array.
229+ ]
230+ withArguments: { values. Float infinity }
207231 serializationStrategy: GtRsrWireSerializationStrategy .
208232
209- self assert: result equals: Float pi .
233+ self assert: result equals: values .
210234]
211235
212236{ #category : #examples }
@@ -240,6 +264,54 @@ GtRemoteGemStoneWireEncodingExamples >> passAndRetrieveGeneralObject [
240264 self assert: result last items first equals: anObject last items first
241265]
242266
267+ { #category : #examples }
268+ GtRemoteGemStoneWireEncodingExamples >> passAndRetrievePrimitives [
269+ " Ensure that primitive types (subclasses of GtWireObjectEncoder) are passed correctly using the wire encoder."
270+ < gtExample>
271+ < return: #AssertionFailure >
272+ | values block session result |
273+
274+ session := self runningServer.
275+
276+ (session hasFeatureNamed: #floatStringEncoding ) ifFalse: [ ^ self ].
277+
278+ values := {
279+ 1 - > ' one' .
280+ false .
281+ true .
282+ #[1 2 3] .
283+ ' a string' .
284+ #aSymbol .
285+ $x.
286+ Dictionary .
287+ { 1 . 2 . 3 . }.
288+ { 1 - > ' one' } asDictionary.
289+ { 1 . 2 . 3 . } asOrderedCollection.
290+ { 1 . 2 . 3 . } asSet.
291+ DateAndTime now.
292+ 1.25 .
293+ SmallInteger minVal.
294+ SmallInteger maxVal.
295+ SmallInteger minVal negated * 2 .
296+ SmallInteger maxVal negated * 2 .
297+ nil .
298+ 3 / 5 .
299+ 1000000000 / 7 .
300+ }.
301+ self assert: (values at: 21 ) class identicalTo: Fraction .
302+ block := [ 42 ].
303+
304+ result := session evaluateBlockAndWait: [ :array :bc |
305+ bc value = 42 ifFalse:
306+ [ nil error: ' Unexpected block value: ' , bc value asString ].
307+ { array. bc. } ]
308+ withArguments: { values. block. }
309+ serializationStrategy: GtRsrWireSerializationStrategy .
310+
311+ self assert: result first equals: values.
312+ self assert: result second value equals: block value.
313+ ]
314+
243315{ #category : #examples }
244316GtRemoteGemStoneWireEncodingExamples >> passProxyAsync [
245317 " Check sending a proxy object to GemStone using wire encoding"
0 commit comments