mirror of
https://github.com/XRPLF/clio.git
synced 2025-12-06 17:27:58 +00:00
feat: Proxy support (#2490)
Add client IP resolving support in case when there is a proxy in front of Clio.
This commit is contained in:
47
tests/unit/util/ShasumTests.cpp
Normal file
47
tests/unit/util/ShasumTests.cpp
Normal file
@@ -0,0 +1,47 @@
|
||||
//------------------------------------------------------------------------------
|
||||
/*
|
||||
This file is part of clio: https://github.com/XRPLF/clio
|
||||
Copyright (c) 2025, the clio developers.
|
||||
|
||||
Permission to use, copy, modify, and distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
//==============================================================================
|
||||
|
||||
#include "util/Shasum.hpp"
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
#include <xrpl/basics/base_uint.h>
|
||||
|
||||
using namespace util;
|
||||
|
||||
struct ShasumTest : testing::Test {
|
||||
static constexpr auto kEMPTY_HASH = "E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855";
|
||||
static constexpr auto kHELLO_WORLD_HASH = "B94D27B9934D3E08A52E52D7DA7DABFAC484EFE37A5380EE9088F7ACE2EFCDE9";
|
||||
};
|
||||
|
||||
TEST_F(ShasumTest, sha256sum)
|
||||
{
|
||||
ripple::uint256 expected;
|
||||
|
||||
ASSERT_TRUE(expected.parseHex(kEMPTY_HASH));
|
||||
EXPECT_EQ(sha256sum(""), expected);
|
||||
|
||||
ASSERT_TRUE(expected.parseHex(kHELLO_WORLD_HASH));
|
||||
EXPECT_EQ(sha256sum("hello world"), expected);
|
||||
}
|
||||
|
||||
TEST_F(ShasumTest, sha256sumString)
|
||||
{
|
||||
EXPECT_EQ(sha256sumString(""), kEMPTY_HASH);
|
||||
EXPECT_EQ(sha256sumString("hello world"), kHELLO_WORLD_HASH);
|
||||
}
|
||||
Reference in New Issue
Block a user