diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml index a65a8ad..2aaa0a2 100644 --- a/.github/workflows/integration.yml +++ b/.github/workflows/integration.yml @@ -1,4 +1,4 @@ -name: Build as library +name: Integration on: push: @@ -7,7 +7,7 @@ on: branches: [ "main" ] jobs: - Integration-as-library: + Build-as-library: runs-on: ${{ matrix.os }} strategy: @@ -55,7 +55,7 @@ jobs: cmake --build ${{ steps.strings.outputs.build }} --target Library_Integration -j 8 ./Library_Integration - Prezentation: + Presentation: runs-on: ${{ matrix.os }} strategy: diff --git a/Aesi.h b/Aesi.h index d41d199..c3790fb 100755 --- a/Aesi.h +++ b/Aesi.h @@ -206,7 +206,7 @@ class Aesi final { * @brief Copy assignment operator * @param other Aesi& */ - gpu constexpr Aesi& operator=(const Aesi& other) noexcept { base = other.base; sign = other.sign; return *this; } + gpu constexpr Aesi& operator=(const Aesi& other) noexcept = default; /* ----------------------------------------------------------------------- */ @@ -632,23 +632,19 @@ class Aesi final { return our.compareTo(integral) == Comparison::equal; } - /** - * @brief Equality operator - * @param our Aesi - * @param other Aesi - * @return bool - */ - gpu constexpr friend auto operator==(const Aesi& our, const Aesi& other) noexcept -> bool = default; - /** * @brief Different precision equlity operator * @param our Aesi * @param other Aesi * @return bool */ - template requires (otherBitness != bitness) + template gpu constexpr friend auto operator==(const Aesi& our, const Aesi& other) noexcept -> bool { - return our.precisionCast() == other; + if constexpr (bitness == otherBitness) { + return our.compareTo(other) == Comparison::equal; + } else { + return our.precisionCast() == other; + } } /* --------------------------------------------------------------------------- */ diff --git a/Aeu.h b/Aeu.h index fe8ebe5..7fe4f78 100755 --- a/Aeu.h +++ b/Aeu.h @@ -755,24 +755,16 @@ class Aeu final { return our.filledBlocksNumber() <= 2 && (static_cast(our.blocks[1]) << blockBitLength | static_cast(our.blocks[0])) == other; } - /** - * @brief Equality check operator for numbers of the same precision - * @param our Aeu - * @param other Aeu - * @return Boolean - */ - gpu constexpr friend auto operator==(const Aeu& our, const Aeu& other) noexcept -> bool = default; - /** * @brief Templated Equality check operator for numbers of different precision * @param our Aeu * @param other Aeu * @return Boolean */ - template requires (otherBitness != bitness) + template gpu constexpr friend auto operator==(const Aeu& our, const Aeu& other) noexcept -> bool { return our.compareTo(other) == Comparison::equal; - }; + } /* --------------------------------------------------------------------------- */ diff --git a/test/generation.h b/test/generation.h index 472b2b4..93e937c 100755 --- a/test/generation.h +++ b/test/generation.h @@ -8,8 +8,7 @@ #include namespace Generation { - using CryptoPP::Integer; - using UnsPP = Integer; + using UnsPP = CryptoPP::Integer; using UnsGmp = mpz_class; static std::random_device dev; diff --git a/test/operations/initialization/signed.cpp b/test/operations/initialization/signed.cpp index 20ac736..0b332cf 100755 --- a/test/operations/initialization/signed.cpp +++ b/test/operations/initialization/signed.cpp @@ -65,7 +65,7 @@ TEST(Signed_Initialization, Basic) { } TEST(Signed_Initialization, Different_precisions) { - uint64_t iValue0 = -3218136187561313218u; + int64_t iValue0 = -3218136187561313218LL; Aesi < 96 > o00 = iValue0; Aesi < 96 > o01 = iValue0; @@ -94,6 +94,7 @@ TEST(Signed_Initialization, Binary) { binary += (byte & 1 ? '1' : '0'); std::stringstream ss {}; ss << (i % 2 == 0 ? "" : "-") << "0b" << std::string(binary.rbegin(), binary.rend()); + for(long long j = value.ByteCount() - 2; j >= 0; --j) ss << std::bitset<8>(value.GetByte(j)); record = ss.str(); EXPECT_EQ(record, value); @@ -117,7 +118,9 @@ TEST(Signed_Initialization, Octal) { const auto value = (i % 2 == 0 ? 1 : -1) * Generation::getRandomWithBits(blocksNumber * 32 - 20); record = value; EXPECT_EQ(record, value); - std::stringstream ss {}; ss << (i % 2 == 0 ? "" : "-") << "0o" << std::oct << (i % 2 == 0 ? value : value * -1); + std::stringstream ss {}; + ss << (i % 2 == 0 ? "" : "-") << "0o" << std::oct << (i % 2 == 0 ? value : value * -1); + record = ss.str(); EXPECT_EQ(record, value); } } @@ -130,9 +133,9 @@ TEST(Signed_Initialization, Hexadecimal) { std::stringstream ss {}; if(i % 2 == 0) - ss << (i % 2 == 0 ? "" : "-") << "0x" << std::hex << std::uppercase << (i % 2 == 0 ? value : value * -1); + ss << "0x" << std::hex << std::uppercase << (i % 2 == 0 ? value : value * -1); else - ss << (i % 2 == 0 ? "" : "-") << "0x" << std::hex << std::nouppercase << (i % 2 == 0 ? value : value * -1); + ss << "-0x" << std::hex << std::nouppercase << (i % 2 == 0 ? value : value * -1); record = ss.str(); EXPECT_EQ(record, value); } }