From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 3F5ED6EC55; Wed, 28 Jul 2021 00:26:19 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 3F5ED6EC55 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1627421179; bh=ilNOSx4iBCNPUMozOcvS/PN9JdE6AW2YukDSotoZ9Vg=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=F82f9Mzr6Tzup8S+nYH2gvY+lywBgQgbvhZZLnDTO+C3v+my7XVd5ze68c9Fx4yWS gnTONA66KeKMZ8pggDvnsJYJ5soz8xgBVvy4Rqc1PlMJugsMvmMv9nq7c4nGIX/INL 46REE47hnngST6rAgLLROSh/aSehm48rmvq59X20= Received: from smtpng3.i.mail.ru (smtpng3.i.mail.ru [94.100.177.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 1CE156EC5A for ; Wed, 28 Jul 2021 00:24:21 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 1CE156EC5A Received: by smtpng3.m.smailru.net with esmtpa (envelope-from ) id 1m8UYm-0005in-2t; Wed, 28 Jul 2021 00:24:20 +0300 To: tarantool-patches@dev.tarantool.org, gorcunov@gmail.com, sergos@tarantool.org Date: Tue, 27 Jul 2021 23:24:14 +0200 Message-Id: <175f212fc092d0da8e5d773160042db5770fee2e.1627420835.git.v.shpilevoy@tarantool.org> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD941C43E597735A9C3104FC76DFAAAAF7DA068FE323FAC4379182A05F53808504006D84F1BD16C82433DAB9C70388EA4A2A9DD8F41DCEF89A7201EF151C51A99B9 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7F0ABDA2F087648F5EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006370E5D717DF121F99E8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D84C8DFF86C60BA901A1A07DA14B8741AE117882F4460429724CE54428C33FAD305F5C1EE8F4F765FCAA867293B0326636D2E47CDBA5A96583BD4B6F7A4D31EC0BC014FD901B82EE079FA2833FD35BB23D27C277FBC8AE2E8B8C7ADC89C2F0B2A5A471835C12D1D977C4224003CC8364762BB6847A3DEAEFB0F43C7A68FF6260569E8FC8737B5C2249EC8D19AE6D49635B68655334FD4449CB9ECD01F8117BC8BEAAAE862A0553A39223F8577A6DFFEA7C565C1E6824D8037B43847C11F186F3C59DAA53EE0834AAEE X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A213B5FB47DCBC3458834459D11680B505E2552B0CE6D9DCA4E39EF331F0032048 X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C414F749A5E30D975C7BEA09003D200E08CA67E27C1C1D092C2A35B51AB2025F3F9C2B6934AE262D3EE7EAB7254005DCED7532B743992DF240BDC6A1CF3F042BAD6DF99611D93F60EFA5DF9383870C0FED699F904B3F4130E343918A1A30D5E7FCCB5012B2E24CD356 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34AF61ACC197BF517A9FFB968C9DAAD44BBE63A9E171134CB2F3B0F676FD7F9CAD19A7374B680F4B521D7E09C32AA3244CED84CC900F2998C7D08C5758B18E599DBBA718C7E6A9E042FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojiF1u9eOpfTTsr0kMNyM5hA== X-Mailru-Sender: 689FA8AB762F7393C37E3C1AEC41BA5D3137A6792BB083898062B6A82C63EF4F3841015FED1DE5223CC9A89AB576DD93FB559BB5D741EB963CF37A108A312F5C27E8A8C3839CE0E267EA787935ED9F1B X-Mras: Ok Subject: [Tarantool-patches] [PATCH 4/5] decimal: introduce decimal_to_string X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Vladislav Shpilevoy via Tarantool-patches Reply-To: Vladislav Shpilevoy Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" It saves decimal as a string into an externally passed buffer. This will be used by places which can not use the static buffer returned by decimal_str(). Part of #6259 --- src/lib/core/decimal.c | 8 + src/lib/core/decimal.h | 12 ++ test/unit/decimal.c | 5 +- test/unit/decimal.result | 394 ++++++++++++++++++++------------------- 4 files changed, 230 insertions(+), 189 deletions(-) diff --git a/src/lib/core/decimal.c b/src/lib/core/decimal.c index 4befbda37..6d2ccb96f 100644 --- a/src/lib/core/decimal.c +++ b/src/lib/core/decimal.c @@ -175,6 +175,14 @@ decimal_str(const decimal_t *dec) return buf; } +void +decimal_to_string(const decimal_t *dec, char *str) +{ + char *tmp = decNumberToString(dec, str); + assert(str == tmp); + (void)tmp; +} + static decimal_t * decimal_to_integer(decimal_t *dec) { diff --git a/src/lib/core/decimal.h b/src/lib/core/decimal.h index d2f2dfbdb..aeafd2c68 100644 --- a/src/lib/core/decimal.h +++ b/src/lib/core/decimal.h @@ -42,6 +42,14 @@ extern "C" { #endif /* defined(__cplusplus) */ +enum { + /* + * The documentation in the decnumber sources says the string needs to + * be >= digit count + 14. + */ + DECIMAL_MAX_STR_LEN = DECIMAL_MAX_DIGITS + 14, +}; + typedef decNumber decimal_t; /** @@ -128,6 +136,10 @@ decimal_from_uint64(decimal_t *dec, uint64_t num); const char * decimal_str(const decimal_t *dec); +/** Write the decimal as a string into the passed buffer. */ +void +decimal_to_string(const decimal_t *dec, char *str); + /** * Convert a given decimal to int64_t * \param[out] num - the result diff --git a/test/unit/decimal.c b/test/unit/decimal.c index 756c68518..aea646e15 100644 --- a/test/unit/decimal.c +++ b/test/unit/decimal.c @@ -108,6 +108,9 @@ char buf[32]; is(decimal_compare(&dec, &d2), 0, "mp_decode(mp_encode("str")) value");\ is(decimal_scale(&dec), decimal_scale(&d2), "mp_decode(mp_encode("str")) scale");\ is(strcmp(decimal_str(&d2), str), 0, "str(mp_decode(mp_encode("str"))) == "str);\ + char strbuf[DECIMAL_MAX_STR_LEN + 1];\ + decimal_to_string(&dec, strbuf);\ + is(strcmp(strbuf, decimal_str(&dec)), 0, "stack str == static str for "str);\ b2 = buf;\ int8_t type;\ uint32_t l2 = mp_decode_extl(&b2, &type);\ @@ -194,7 +197,7 @@ test_pack_unpack(void) static int test_mp_decimal(void) { - plan(198); + plan(216); test_mpdec("0"); test_mpdec("-0"); diff --git a/test/unit/decimal.result b/test/unit/decimal.result index 8f6de61a7..b7da2d2ce 100644 --- a/test/unit/decimal.result +++ b/test/unit/decimal.result @@ -498,7 +498,7 @@ ok 279 - subtests ok 150 - unpack malformed decimal fails ok 151 - decode malformed decimal preserves buffer position ok 280 - subtests - 1..198 + 1..216 ok 1 - mp_sizeof_decimal(0) ok 2 - mp_sizeof_decimal(0) == len(mp_encode_decimal(0)) ok 3 - mp_next(mp_encode(0)) @@ -506,197 +506,215 @@ ok 280 - subtests ok 5 - mp_decode(mp_encode(0)) value ok 6 - mp_decode(mp_encode(0)) scale ok 7 - str(mp_decode(mp_encode(0))) == 0 - ok 8 - mp_ext_type is MP_DECIMAL - ok 9 - decimal_unpack() after mp_decode_extl() - ok 10 - decimal_unpack() after mp_decode_extl() value - ok 11 - decimal_unpack() after mp_decode_extl() len - ok 12 - mp_sizeof_decimal(-0) - ok 13 - mp_sizeof_decimal(-0) == len(mp_encode_decimal(-0)) - ok 14 - mp_next(mp_encode(-0)) - ok 15 - mp_decode(mp_encode(-0) len - ok 16 - mp_decode(mp_encode(-0)) value - ok 17 - mp_decode(mp_encode(-0)) scale - ok 18 - str(mp_decode(mp_encode(-0))) == -0 - ok 19 - mp_ext_type is MP_DECIMAL - ok 20 - decimal_unpack() after mp_decode_extl() - ok 21 - decimal_unpack() after mp_decode_extl() value - ok 22 - decimal_unpack() after mp_decode_extl() len - ok 23 - mp_sizeof_decimal(1) - ok 24 - mp_sizeof_decimal(1) == len(mp_encode_decimal(1)) - ok 25 - mp_next(mp_encode(1)) - ok 26 - mp_decode(mp_encode(1) len - ok 27 - mp_decode(mp_encode(1)) value - ok 28 - mp_decode(mp_encode(1)) scale - ok 29 - str(mp_decode(mp_encode(1))) == 1 - ok 30 - mp_ext_type is MP_DECIMAL - ok 31 - decimal_unpack() after mp_decode_extl() - ok 32 - decimal_unpack() after mp_decode_extl() value - ok 33 - decimal_unpack() after mp_decode_extl() len - ok 34 - mp_sizeof_decimal(-1) - ok 35 - mp_sizeof_decimal(-1) == len(mp_encode_decimal(-1)) - ok 36 - mp_next(mp_encode(-1)) - ok 37 - mp_decode(mp_encode(-1) len - ok 38 - mp_decode(mp_encode(-1)) value - ok 39 - mp_decode(mp_encode(-1)) scale - ok 40 - str(mp_decode(mp_encode(-1))) == -1 - ok 41 - mp_ext_type is MP_DECIMAL - ok 42 - decimal_unpack() after mp_decode_extl() - ok 43 - decimal_unpack() after mp_decode_extl() value - ok 44 - decimal_unpack() after mp_decode_extl() len - ok 45 - mp_sizeof_decimal(0.1) - ok 46 - mp_sizeof_decimal(0.1) == len(mp_encode_decimal(0.1)) - ok 47 - mp_next(mp_encode(0.1)) - ok 48 - mp_decode(mp_encode(0.1) len - ok 49 - mp_decode(mp_encode(0.1)) value - ok 50 - mp_decode(mp_encode(0.1)) scale - ok 51 - str(mp_decode(mp_encode(0.1))) == 0.1 - ok 52 - mp_ext_type is MP_DECIMAL - ok 53 - decimal_unpack() after mp_decode_extl() - ok 54 - decimal_unpack() after mp_decode_extl() value - ok 55 - decimal_unpack() after mp_decode_extl() len - ok 56 - mp_sizeof_decimal(-0.1) - ok 57 - mp_sizeof_decimal(-0.1) == len(mp_encode_decimal(-0.1)) - ok 58 - mp_next(mp_encode(-0.1)) - ok 59 - mp_decode(mp_encode(-0.1) len - ok 60 - mp_decode(mp_encode(-0.1)) value - ok 61 - mp_decode(mp_encode(-0.1)) scale - ok 62 - str(mp_decode(mp_encode(-0.1))) == -0.1 - ok 63 - mp_ext_type is MP_DECIMAL - ok 64 - decimal_unpack() after mp_decode_extl() - ok 65 - decimal_unpack() after mp_decode_extl() value - ok 66 - decimal_unpack() after mp_decode_extl() len - ok 67 - mp_sizeof_decimal(2.718281828459045) - ok 68 - mp_sizeof_decimal(2.718281828459045) == len(mp_encode_decimal(2.718281828459045)) - ok 69 - mp_next(mp_encode(2.718281828459045)) - ok 70 - mp_decode(mp_encode(2.718281828459045) len - ok 71 - mp_decode(mp_encode(2.718281828459045)) value - ok 72 - mp_decode(mp_encode(2.718281828459045)) scale - ok 73 - str(mp_decode(mp_encode(2.718281828459045))) == 2.718281828459045 - ok 74 - mp_ext_type is MP_DECIMAL - ok 75 - decimal_unpack() after mp_decode_extl() - ok 76 - decimal_unpack() after mp_decode_extl() value - ok 77 - decimal_unpack() after mp_decode_extl() len - ok 78 - mp_sizeof_decimal(-2.718281828459045) - ok 79 - mp_sizeof_decimal(-2.718281828459045) == len(mp_encode_decimal(-2.718281828459045)) - ok 80 - mp_next(mp_encode(-2.718281828459045)) - ok 81 - mp_decode(mp_encode(-2.718281828459045) len - ok 82 - mp_decode(mp_encode(-2.718281828459045)) value - ok 83 - mp_decode(mp_encode(-2.718281828459045)) scale - ok 84 - str(mp_decode(mp_encode(-2.718281828459045))) == -2.718281828459045 - ok 85 - mp_ext_type is MP_DECIMAL - ok 86 - decimal_unpack() after mp_decode_extl() - ok 87 - decimal_unpack() after mp_decode_extl() value - ok 88 - decimal_unpack() after mp_decode_extl() len - ok 89 - mp_sizeof_decimal(3.141592653589793) - ok 90 - mp_sizeof_decimal(3.141592653589793) == len(mp_encode_decimal(3.141592653589793)) - ok 91 - mp_next(mp_encode(3.141592653589793)) - ok 92 - mp_decode(mp_encode(3.141592653589793) len - ok 93 - mp_decode(mp_encode(3.141592653589793)) value - ok 94 - mp_decode(mp_encode(3.141592653589793)) scale - ok 95 - str(mp_decode(mp_encode(3.141592653589793))) == 3.141592653589793 - ok 96 - mp_ext_type is MP_DECIMAL - ok 97 - decimal_unpack() after mp_decode_extl() - ok 98 - decimal_unpack() after mp_decode_extl() value - ok 99 - decimal_unpack() after mp_decode_extl() len - ok 100 - mp_sizeof_decimal(-3.141592653589793) - ok 101 - mp_sizeof_decimal(-3.141592653589793) == len(mp_encode_decimal(-3.141592653589793)) - ok 102 - mp_next(mp_encode(-3.141592653589793)) - ok 103 - mp_decode(mp_encode(-3.141592653589793) len - ok 104 - mp_decode(mp_encode(-3.141592653589793)) value - ok 105 - mp_decode(mp_encode(-3.141592653589793)) scale - ok 106 - str(mp_decode(mp_encode(-3.141592653589793))) == -3.141592653589793 - ok 107 - mp_ext_type is MP_DECIMAL - ok 108 - decimal_unpack() after mp_decode_extl() - ok 109 - decimal_unpack() after mp_decode_extl() value - ok 110 - decimal_unpack() after mp_decode_extl() len - ok 111 - mp_sizeof_decimal(1234567891234567890.0987654321987654321) - ok 112 - mp_sizeof_decimal(1234567891234567890.0987654321987654321) == len(mp_encode_decimal(1234567891234567890.0987654321987654321)) - ok 113 - mp_next(mp_encode(1234567891234567890.0987654321987654321)) - ok 114 - mp_decode(mp_encode(1234567891234567890.0987654321987654321) len - ok 115 - mp_decode(mp_encode(1234567891234567890.0987654321987654321)) value - ok 116 - mp_decode(mp_encode(1234567891234567890.0987654321987654321)) scale - ok 117 - str(mp_decode(mp_encode(1234567891234567890.0987654321987654321))) == 1234567891234567890.0987654321987654321 - ok 118 - mp_ext_type is MP_DECIMAL - ok 119 - decimal_unpack() after mp_decode_extl() - ok 120 - decimal_unpack() after mp_decode_extl() value - ok 121 - decimal_unpack() after mp_decode_extl() len - ok 122 - mp_sizeof_decimal(-1234567891234567890.0987654321987654321) - ok 123 - mp_sizeof_decimal(-1234567891234567890.0987654321987654321) == len(mp_encode_decimal(-1234567891234567890.0987654321987654321)) - ok 124 - mp_next(mp_encode(-1234567891234567890.0987654321987654321)) - ok 125 - mp_decode(mp_encode(-1234567891234567890.0987654321987654321) len - ok 126 - mp_decode(mp_encode(-1234567891234567890.0987654321987654321)) value - ok 127 - mp_decode(mp_encode(-1234567891234567890.0987654321987654321)) scale - ok 128 - str(mp_decode(mp_encode(-1234567891234567890.0987654321987654321))) == -1234567891234567890.0987654321987654321 + ok 8 - stack str == static str for 0 + ok 9 - mp_ext_type is MP_DECIMAL + ok 10 - decimal_unpack() after mp_decode_extl() + ok 11 - decimal_unpack() after mp_decode_extl() value + ok 12 - decimal_unpack() after mp_decode_extl() len + ok 13 - mp_sizeof_decimal(-0) + ok 14 - mp_sizeof_decimal(-0) == len(mp_encode_decimal(-0)) + ok 15 - mp_next(mp_encode(-0)) + ok 16 - mp_decode(mp_encode(-0) len + ok 17 - mp_decode(mp_encode(-0)) value + ok 18 - mp_decode(mp_encode(-0)) scale + ok 19 - str(mp_decode(mp_encode(-0))) == -0 + ok 20 - stack str == static str for -0 + ok 21 - mp_ext_type is MP_DECIMAL + ok 22 - decimal_unpack() after mp_decode_extl() + ok 23 - decimal_unpack() after mp_decode_extl() value + ok 24 - decimal_unpack() after mp_decode_extl() len + ok 25 - mp_sizeof_decimal(1) + ok 26 - mp_sizeof_decimal(1) == len(mp_encode_decimal(1)) + ok 27 - mp_next(mp_encode(1)) + ok 28 - mp_decode(mp_encode(1) len + ok 29 - mp_decode(mp_encode(1)) value + ok 30 - mp_decode(mp_encode(1)) scale + ok 31 - str(mp_decode(mp_encode(1))) == 1 + ok 32 - stack str == static str for 1 + ok 33 - mp_ext_type is MP_DECIMAL + ok 34 - decimal_unpack() after mp_decode_extl() + ok 35 - decimal_unpack() after mp_decode_extl() value + ok 36 - decimal_unpack() after mp_decode_extl() len + ok 37 - mp_sizeof_decimal(-1) + ok 38 - mp_sizeof_decimal(-1) == len(mp_encode_decimal(-1)) + ok 39 - mp_next(mp_encode(-1)) + ok 40 - mp_decode(mp_encode(-1) len + ok 41 - mp_decode(mp_encode(-1)) value + ok 42 - mp_decode(mp_encode(-1)) scale + ok 43 - str(mp_decode(mp_encode(-1))) == -1 + ok 44 - stack str == static str for -1 + ok 45 - mp_ext_type is MP_DECIMAL + ok 46 - decimal_unpack() after mp_decode_extl() + ok 47 - decimal_unpack() after mp_decode_extl() value + ok 48 - decimal_unpack() after mp_decode_extl() len + ok 49 - mp_sizeof_decimal(0.1) + ok 50 - mp_sizeof_decimal(0.1) == len(mp_encode_decimal(0.1)) + ok 51 - mp_next(mp_encode(0.1)) + ok 52 - mp_decode(mp_encode(0.1) len + ok 53 - mp_decode(mp_encode(0.1)) value + ok 54 - mp_decode(mp_encode(0.1)) scale + ok 55 - str(mp_decode(mp_encode(0.1))) == 0.1 + ok 56 - stack str == static str for 0.1 + ok 57 - mp_ext_type is MP_DECIMAL + ok 58 - decimal_unpack() after mp_decode_extl() + ok 59 - decimal_unpack() after mp_decode_extl() value + ok 60 - decimal_unpack() after mp_decode_extl() len + ok 61 - mp_sizeof_decimal(-0.1) + ok 62 - mp_sizeof_decimal(-0.1) == len(mp_encode_decimal(-0.1)) + ok 63 - mp_next(mp_encode(-0.1)) + ok 64 - mp_decode(mp_encode(-0.1) len + ok 65 - mp_decode(mp_encode(-0.1)) value + ok 66 - mp_decode(mp_encode(-0.1)) scale + ok 67 - str(mp_decode(mp_encode(-0.1))) == -0.1 + ok 68 - stack str == static str for -0.1 + ok 69 - mp_ext_type is MP_DECIMAL + ok 70 - decimal_unpack() after mp_decode_extl() + ok 71 - decimal_unpack() after mp_decode_extl() value + ok 72 - decimal_unpack() after mp_decode_extl() len + ok 73 - mp_sizeof_decimal(2.718281828459045) + ok 74 - mp_sizeof_decimal(2.718281828459045) == len(mp_encode_decimal(2.718281828459045)) + ok 75 - mp_next(mp_encode(2.718281828459045)) + ok 76 - mp_decode(mp_encode(2.718281828459045) len + ok 77 - mp_decode(mp_encode(2.718281828459045)) value + ok 78 - mp_decode(mp_encode(2.718281828459045)) scale + ok 79 - str(mp_decode(mp_encode(2.718281828459045))) == 2.718281828459045 + ok 80 - stack str == static str for 2.718281828459045 + ok 81 - mp_ext_type is MP_DECIMAL + ok 82 - decimal_unpack() after mp_decode_extl() + ok 83 - decimal_unpack() after mp_decode_extl() value + ok 84 - decimal_unpack() after mp_decode_extl() len + ok 85 - mp_sizeof_decimal(-2.718281828459045) + ok 86 - mp_sizeof_decimal(-2.718281828459045) == len(mp_encode_decimal(-2.718281828459045)) + ok 87 - mp_next(mp_encode(-2.718281828459045)) + ok 88 - mp_decode(mp_encode(-2.718281828459045) len + ok 89 - mp_decode(mp_encode(-2.718281828459045)) value + ok 90 - mp_decode(mp_encode(-2.718281828459045)) scale + ok 91 - str(mp_decode(mp_encode(-2.718281828459045))) == -2.718281828459045 + ok 92 - stack str == static str for -2.718281828459045 + ok 93 - mp_ext_type is MP_DECIMAL + ok 94 - decimal_unpack() after mp_decode_extl() + ok 95 - decimal_unpack() after mp_decode_extl() value + ok 96 - decimal_unpack() after mp_decode_extl() len + ok 97 - mp_sizeof_decimal(3.141592653589793) + ok 98 - mp_sizeof_decimal(3.141592653589793) == len(mp_encode_decimal(3.141592653589793)) + ok 99 - mp_next(mp_encode(3.141592653589793)) + ok 100 - mp_decode(mp_encode(3.141592653589793) len + ok 101 - mp_decode(mp_encode(3.141592653589793)) value + ok 102 - mp_decode(mp_encode(3.141592653589793)) scale + ok 103 - str(mp_decode(mp_encode(3.141592653589793))) == 3.141592653589793 + ok 104 - stack str == static str for 3.141592653589793 + ok 105 - mp_ext_type is MP_DECIMAL + ok 106 - decimal_unpack() after mp_decode_extl() + ok 107 - decimal_unpack() after mp_decode_extl() value + ok 108 - decimal_unpack() after mp_decode_extl() len + ok 109 - mp_sizeof_decimal(-3.141592653589793) + ok 110 - mp_sizeof_decimal(-3.141592653589793) == len(mp_encode_decimal(-3.141592653589793)) + ok 111 - mp_next(mp_encode(-3.141592653589793)) + ok 112 - mp_decode(mp_encode(-3.141592653589793) len + ok 113 - mp_decode(mp_encode(-3.141592653589793)) value + ok 114 - mp_decode(mp_encode(-3.141592653589793)) scale + ok 115 - str(mp_decode(mp_encode(-3.141592653589793))) == -3.141592653589793 + ok 116 - stack str == static str for -3.141592653589793 + ok 117 - mp_ext_type is MP_DECIMAL + ok 118 - decimal_unpack() after mp_decode_extl() + ok 119 - decimal_unpack() after mp_decode_extl() value + ok 120 - decimal_unpack() after mp_decode_extl() len + ok 121 - mp_sizeof_decimal(1234567891234567890.0987654321987654321) + ok 122 - mp_sizeof_decimal(1234567891234567890.0987654321987654321) == len(mp_encode_decimal(1234567891234567890.0987654321987654321)) + ok 123 - mp_next(mp_encode(1234567891234567890.0987654321987654321)) + ok 124 - mp_decode(mp_encode(1234567891234567890.0987654321987654321) len + ok 125 - mp_decode(mp_encode(1234567891234567890.0987654321987654321)) value + ok 126 - mp_decode(mp_encode(1234567891234567890.0987654321987654321)) scale + ok 127 - str(mp_decode(mp_encode(1234567891234567890.0987654321987654321))) == 1234567891234567890.0987654321987654321 + ok 128 - stack str == static str for 1234567891234567890.0987654321987654321 ok 129 - mp_ext_type is MP_DECIMAL ok 130 - decimal_unpack() after mp_decode_extl() ok 131 - decimal_unpack() after mp_decode_extl() value ok 132 - decimal_unpack() after mp_decode_extl() len - ok 133 - mp_sizeof_decimal(0.0000000000000000000000000000000000001) - ok 134 - mp_sizeof_decimal(0.0000000000000000000000000000000000001) == len(mp_encode_decimal(0.0000000000000000000000000000000000001)) - ok 135 - mp_next(mp_encode(0.0000000000000000000000000000000000001)) - ok 136 - mp_decode(mp_encode(0.0000000000000000000000000000000000001) len - ok 137 - mp_decode(mp_encode(0.0000000000000000000000000000000000001)) value - ok 138 - mp_decode(mp_encode(0.0000000000000000000000000000000000001)) scale - ok 139 - str(mp_decode(mp_encode(0.0000000000000000000000000000000000001))) == 0.0000000000000000000000000000000000001 - ok 140 - mp_ext_type is MP_DECIMAL - ok 141 - decimal_unpack() after mp_decode_extl() - ok 142 - decimal_unpack() after mp_decode_extl() value - ok 143 - decimal_unpack() after mp_decode_extl() len - ok 144 - mp_sizeof_decimal(-0.0000000000000000000000000000000000001) - ok 145 - mp_sizeof_decimal(-0.0000000000000000000000000000000000001) == len(mp_encode_decimal(-0.0000000000000000000000000000000000001)) - ok 146 - mp_next(mp_encode(-0.0000000000000000000000000000000000001)) - ok 147 - mp_decode(mp_encode(-0.0000000000000000000000000000000000001) len - ok 148 - mp_decode(mp_encode(-0.0000000000000000000000000000000000001)) value - ok 149 - mp_decode(mp_encode(-0.0000000000000000000000000000000000001)) scale - ok 150 - str(mp_decode(mp_encode(-0.0000000000000000000000000000000000001))) == -0.0000000000000000000000000000000000001 - ok 151 - mp_ext_type is MP_DECIMAL - ok 152 - decimal_unpack() after mp_decode_extl() - ok 153 - decimal_unpack() after mp_decode_extl() value - ok 154 - decimal_unpack() after mp_decode_extl() len - ok 155 - mp_sizeof_decimal(0.00000000000000000000000000000000000001) - ok 156 - mp_sizeof_decimal(0.00000000000000000000000000000000000001) == len(mp_encode_decimal(0.00000000000000000000000000000000000001)) - ok 157 - mp_next(mp_encode(0.00000000000000000000000000000000000001)) - ok 158 - mp_decode(mp_encode(0.00000000000000000000000000000000000001) len - ok 159 - mp_decode(mp_encode(0.00000000000000000000000000000000000001)) value - ok 160 - mp_decode(mp_encode(0.00000000000000000000000000000000000001)) scale - ok 161 - str(mp_decode(mp_encode(0.00000000000000000000000000000000000001))) == 0.00000000000000000000000000000000000001 - ok 162 - mp_ext_type is MP_DECIMAL - ok 163 - decimal_unpack() after mp_decode_extl() - ok 164 - decimal_unpack() after mp_decode_extl() value - ok 165 - decimal_unpack() after mp_decode_extl() len - ok 166 - mp_sizeof_decimal(-0.00000000000000000000000000000000000001) - ok 167 - mp_sizeof_decimal(-0.00000000000000000000000000000000000001) == len(mp_encode_decimal(-0.00000000000000000000000000000000000001)) - ok 168 - mp_next(mp_encode(-0.00000000000000000000000000000000000001)) - ok 169 - mp_decode(mp_encode(-0.00000000000000000000000000000000000001) len - ok 170 - mp_decode(mp_encode(-0.00000000000000000000000000000000000001)) value - ok 171 - mp_decode(mp_encode(-0.00000000000000000000000000000000000001)) scale - ok 172 - str(mp_decode(mp_encode(-0.00000000000000000000000000000000000001))) == -0.00000000000000000000000000000000000001 - ok 173 - mp_ext_type is MP_DECIMAL - ok 174 - decimal_unpack() after mp_decode_extl() - ok 175 - decimal_unpack() after mp_decode_extl() value - ok 176 - decimal_unpack() after mp_decode_extl() len - ok 177 - mp_sizeof_decimal(99999999999999999999999999999999999999) - ok 178 - mp_sizeof_decimal(99999999999999999999999999999999999999) == len(mp_encode_decimal(99999999999999999999999999999999999999)) - ok 179 - mp_next(mp_encode(99999999999999999999999999999999999999)) - ok 180 - mp_decode(mp_encode(99999999999999999999999999999999999999) len - ok 181 - mp_decode(mp_encode(99999999999999999999999999999999999999)) value - ok 182 - mp_decode(mp_encode(99999999999999999999999999999999999999)) scale - ok 183 - str(mp_decode(mp_encode(99999999999999999999999999999999999999))) == 99999999999999999999999999999999999999 - ok 184 - mp_ext_type is MP_DECIMAL - ok 185 - decimal_unpack() after mp_decode_extl() - ok 186 - decimal_unpack() after mp_decode_extl() value - ok 187 - decimal_unpack() after mp_decode_extl() len - ok 188 - mp_sizeof_decimal(-99999999999999999999999999999999999999) - ok 189 - mp_sizeof_decimal(-99999999999999999999999999999999999999) == len(mp_encode_decimal(-99999999999999999999999999999999999999)) - ok 190 - mp_next(mp_encode(-99999999999999999999999999999999999999)) - ok 191 - mp_decode(mp_encode(-99999999999999999999999999999999999999) len - ok 192 - mp_decode(mp_encode(-99999999999999999999999999999999999999)) value - ok 193 - mp_decode(mp_encode(-99999999999999999999999999999999999999)) scale - ok 194 - str(mp_decode(mp_encode(-99999999999999999999999999999999999999))) == -99999999999999999999999999999999999999 - ok 195 - mp_ext_type is MP_DECIMAL - ok 196 - decimal_unpack() after mp_decode_extl() - ok 197 - decimal_unpack() after mp_decode_extl() value - ok 198 - decimal_unpack() after mp_decode_extl() len + ok 133 - mp_sizeof_decimal(-1234567891234567890.0987654321987654321) + ok 134 - mp_sizeof_decimal(-1234567891234567890.0987654321987654321) == len(mp_encode_decimal(-1234567891234567890.0987654321987654321)) + ok 135 - mp_next(mp_encode(-1234567891234567890.0987654321987654321)) + ok 136 - mp_decode(mp_encode(-1234567891234567890.0987654321987654321) len + ok 137 - mp_decode(mp_encode(-1234567891234567890.0987654321987654321)) value + ok 138 - mp_decode(mp_encode(-1234567891234567890.0987654321987654321)) scale + ok 139 - str(mp_decode(mp_encode(-1234567891234567890.0987654321987654321))) == -1234567891234567890.0987654321987654321 + ok 140 - stack str == static str for -1234567891234567890.0987654321987654321 + ok 141 - mp_ext_type is MP_DECIMAL + ok 142 - decimal_unpack() after mp_decode_extl() + ok 143 - decimal_unpack() after mp_decode_extl() value + ok 144 - decimal_unpack() after mp_decode_extl() len + ok 145 - mp_sizeof_decimal(0.0000000000000000000000000000000000001) + ok 146 - mp_sizeof_decimal(0.0000000000000000000000000000000000001) == len(mp_encode_decimal(0.0000000000000000000000000000000000001)) + ok 147 - mp_next(mp_encode(0.0000000000000000000000000000000000001)) + ok 148 - mp_decode(mp_encode(0.0000000000000000000000000000000000001) len + ok 149 - mp_decode(mp_encode(0.0000000000000000000000000000000000001)) value + ok 150 - mp_decode(mp_encode(0.0000000000000000000000000000000000001)) scale + ok 151 - str(mp_decode(mp_encode(0.0000000000000000000000000000000000001))) == 0.0000000000000000000000000000000000001 + ok 152 - stack str == static str for 0.0000000000000000000000000000000000001 + ok 153 - mp_ext_type is MP_DECIMAL + ok 154 - decimal_unpack() after mp_decode_extl() + ok 155 - decimal_unpack() after mp_decode_extl() value + ok 156 - decimal_unpack() after mp_decode_extl() len + ok 157 - mp_sizeof_decimal(-0.0000000000000000000000000000000000001) + ok 158 - mp_sizeof_decimal(-0.0000000000000000000000000000000000001) == len(mp_encode_decimal(-0.0000000000000000000000000000000000001)) + ok 159 - mp_next(mp_encode(-0.0000000000000000000000000000000000001)) + ok 160 - mp_decode(mp_encode(-0.0000000000000000000000000000000000001) len + ok 161 - mp_decode(mp_encode(-0.0000000000000000000000000000000000001)) value + ok 162 - mp_decode(mp_encode(-0.0000000000000000000000000000000000001)) scale + ok 163 - str(mp_decode(mp_encode(-0.0000000000000000000000000000000000001))) == -0.0000000000000000000000000000000000001 + ok 164 - stack str == static str for -0.0000000000000000000000000000000000001 + ok 165 - mp_ext_type is MP_DECIMAL + ok 166 - decimal_unpack() after mp_decode_extl() + ok 167 - decimal_unpack() after mp_decode_extl() value + ok 168 - decimal_unpack() after mp_decode_extl() len + ok 169 - mp_sizeof_decimal(0.00000000000000000000000000000000000001) + ok 170 - mp_sizeof_decimal(0.00000000000000000000000000000000000001) == len(mp_encode_decimal(0.00000000000000000000000000000000000001)) + ok 171 - mp_next(mp_encode(0.00000000000000000000000000000000000001)) + ok 172 - mp_decode(mp_encode(0.00000000000000000000000000000000000001) len + ok 173 - mp_decode(mp_encode(0.00000000000000000000000000000000000001)) value + ok 174 - mp_decode(mp_encode(0.00000000000000000000000000000000000001)) scale + ok 175 - str(mp_decode(mp_encode(0.00000000000000000000000000000000000001))) == 0.00000000000000000000000000000000000001 + ok 176 - stack str == static str for 0.00000000000000000000000000000000000001 + ok 177 - mp_ext_type is MP_DECIMAL + ok 178 - decimal_unpack() after mp_decode_extl() + ok 179 - decimal_unpack() after mp_decode_extl() value + ok 180 - decimal_unpack() after mp_decode_extl() len + ok 181 - mp_sizeof_decimal(-0.00000000000000000000000000000000000001) + ok 182 - mp_sizeof_decimal(-0.00000000000000000000000000000000000001) == len(mp_encode_decimal(-0.00000000000000000000000000000000000001)) + ok 183 - mp_next(mp_encode(-0.00000000000000000000000000000000000001)) + ok 184 - mp_decode(mp_encode(-0.00000000000000000000000000000000000001) len + ok 185 - mp_decode(mp_encode(-0.00000000000000000000000000000000000001)) value + ok 186 - mp_decode(mp_encode(-0.00000000000000000000000000000000000001)) scale + ok 187 - str(mp_decode(mp_encode(-0.00000000000000000000000000000000000001))) == -0.00000000000000000000000000000000000001 + ok 188 - stack str == static str for -0.00000000000000000000000000000000000001 + ok 189 - mp_ext_type is MP_DECIMAL + ok 190 - decimal_unpack() after mp_decode_extl() + ok 191 - decimal_unpack() after mp_decode_extl() value + ok 192 - decimal_unpack() after mp_decode_extl() len + ok 193 - mp_sizeof_decimal(99999999999999999999999999999999999999) + ok 194 - mp_sizeof_decimal(99999999999999999999999999999999999999) == len(mp_encode_decimal(99999999999999999999999999999999999999)) + ok 195 - mp_next(mp_encode(99999999999999999999999999999999999999)) + ok 196 - mp_decode(mp_encode(99999999999999999999999999999999999999) len + ok 197 - mp_decode(mp_encode(99999999999999999999999999999999999999)) value + ok 198 - mp_decode(mp_encode(99999999999999999999999999999999999999)) scale + ok 199 - str(mp_decode(mp_encode(99999999999999999999999999999999999999))) == 99999999999999999999999999999999999999 + ok 200 - stack str == static str for 99999999999999999999999999999999999999 + ok 201 - mp_ext_type is MP_DECIMAL + ok 202 - decimal_unpack() after mp_decode_extl() + ok 203 - decimal_unpack() after mp_decode_extl() value + ok 204 - decimal_unpack() after mp_decode_extl() len + ok 205 - mp_sizeof_decimal(-99999999999999999999999999999999999999) + ok 206 - mp_sizeof_decimal(-99999999999999999999999999999999999999) == len(mp_encode_decimal(-99999999999999999999999999999999999999)) + ok 207 - mp_next(mp_encode(-99999999999999999999999999999999999999)) + ok 208 - mp_decode(mp_encode(-99999999999999999999999999999999999999) len + ok 209 - mp_decode(mp_encode(-99999999999999999999999999999999999999)) value + ok 210 - mp_decode(mp_encode(-99999999999999999999999999999999999999)) scale + ok 211 - str(mp_decode(mp_encode(-99999999999999999999999999999999999999))) == -99999999999999999999999999999999999999 + ok 212 - stack str == static str for -99999999999999999999999999999999999999 + ok 213 - mp_ext_type is MP_DECIMAL + ok 214 - decimal_unpack() after mp_decode_extl() + ok 215 - decimal_unpack() after mp_decode_extl() value + ok 216 - decimal_unpack() after mp_decode_extl() len ok 281 - subtests 1..5 *** test_mp_print *** -- 2.24.3 (Apple Git-128)