From 902ddcf7d8ab33a1e9f6850f7e0d33277d1a9f54 Mon Sep 17 00:00:00 2001 From: fallenoak Date: Sun, 29 Jan 2023 20:14:01 -0600 Subject: [PATCH] feat(big): add SBigDel --- storm/Big.cpp | 4 ++++ storm/Big.hpp | 2 ++ test/Big.cpp | 8 ++++++++ 3 files changed, 14 insertions(+) diff --git a/storm/Big.cpp b/storm/Big.cpp index 12b2d17..a6db9da 100644 --- a/storm/Big.cpp +++ b/storm/Big.cpp @@ -3,6 +3,10 @@ #include "storm/Memory.hpp" #include +void SBigDel(BigData* num) { + delete num; +} + void SBigFromUnsigned(BigData* num, uint32_t val) { FromUnsigned(num->Primary(), val); } diff --git a/storm/Big.hpp b/storm/Big.hpp index 3759bbd..55b7a3e 100644 --- a/storm/Big.hpp +++ b/storm/Big.hpp @@ -4,6 +4,8 @@ #include "storm/big/BigData.hpp" #include +void SBigDel(BigData* num); + void SBigFromUnsigned(BigData* num, uint32_t val); void SBigNew(BigData** num); diff --git a/test/Big.cpp b/test/Big.cpp index 1886ebc..146ccf0 100644 --- a/test/Big.cpp +++ b/test/Big.cpp @@ -76,6 +76,8 @@ TEST_CASE("SBigFromUnsigned", "[big]") { CHECK(num->Primary().Count() == 1); CHECK(num->Primary()[0] == 0); + + SBigDel(num); } SECTION("creates bigdata from 0x12345678") { @@ -85,6 +87,8 @@ TEST_CASE("SBigFromUnsigned", "[big]") { CHECK(num->Primary().Count() == 1); CHECK(num->Primary()[0] == 0x12345678); + + SBigDel(num); } } @@ -99,6 +103,8 @@ TEST_CASE("SBigToBinaryBuffer", "[big]") { SBigToBinaryBuffer(num, buffer, sizeof(buffer), &bytes); REQUIRE(bytes == 0); + + SBigDel(num); } SECTION("returns expected buffer for bigdata representing 0x12345678") { @@ -112,5 +118,7 @@ TEST_CASE("SBigToBinaryBuffer", "[big]") { CHECK(bytes == 4); CHECK(*reinterpret_cast(buffer) == 0x12345678); + + SBigDel(num); } }