From 504c6accf40985bc36f70df3cdb85d475b218d95 Mon Sep 17 00:00:00 2001 From: Norbert Hartl Date: Tue, 21 Nov 2023 10:00:16 +0100 Subject: [PATCH] reapplied scaled decimal changes to have controlled conversion --- .../SoilPrimitiveSerializationTest.class.st | 2 +- src/Soil-Serializer/SoilBasicMaterializer.class.st | 2 +- src/Soil-Serializer/SoilBasicSerializer.class.st | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Soil-Serializer-Tests/SoilPrimitiveSerializationTest.class.st b/src/Soil-Serializer-Tests/SoilPrimitiveSerializationTest.class.st index ed3e2ed5..0730f183 100644 --- a/src/Soil-Serializer-Tests/SoilPrimitiveSerializationTest.class.st +++ b/src/Soil-Serializer-Tests/SoilPrimitiveSerializationTest.class.st @@ -513,7 +513,7 @@ SoilPrimitiveSerializationTest >> testSerializationScaledDecimal [ serialized := SoilSerializer serializeToBytes: object. self assert: (serialized at: 1) equals: TypeCodeScaledDecimal. - self assert: serialized equals: #[9 10 1 2]. + self assert: serialized equals: #[9 5 10 1 2]. materialized := SoilMaterializer materializeFromBytes: serialized. self assert: materialized class equals: ScaledDecimal. self assert: materialized equals: object diff --git a/src/Soil-Serializer/SoilBasicMaterializer.class.st b/src/Soil-Serializer/SoilBasicMaterializer.class.st index 545b9901..c70561c9 100644 --- a/src/Soil-Serializer/SoilBasicMaterializer.class.st +++ b/src/Soil-Serializer/SoilBasicMaterializer.class.st @@ -104,7 +104,7 @@ SoilBasicMaterializer >> nextScaledDecimal: aClass [ | scaledDecimal | scaledDecimal := aClass new - setNumerator: self nextLengthEncodedInteger + setNumerator: self nextSoilObject denominator: self nextLengthEncodedInteger scale: self nextLengthEncodedInteger. self registerObject: scaledDecimal. diff --git a/src/Soil-Serializer/SoilBasicSerializer.class.st b/src/Soil-Serializer/SoilBasicSerializer.class.st index 31d8d815..f008ab62 100644 --- a/src/Soil-Serializer/SoilBasicSerializer.class.st +++ b/src/Soil-Serializer/SoilBasicSerializer.class.st @@ -121,7 +121,7 @@ SoilBasicSerializer >> nextPutScaledDecimal: aNumber [ "we know that numerator, denominator and scale are SmallIntegers" self nextPutByte: TypeCodeScaledDecimal; - nextPutLengthEncodedInteger: aNumber numerator; + nextPutInteger: aNumber numerator; nextPutLengthEncodedInteger: aNumber denominator; nextPutLengthEncodedInteger: aNumber scale ]