Skip to content

Commit

Permalink
Enforce convention
Browse files Browse the repository at this point in the history
All the testing related stuffs are static unless required to be extern
  • Loading branch information
jk-jeon committed Apr 10, 2024
1 parent ad07c8c commit c6152a8
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions subproject/test/source/test_all_shorter_interval_cases.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
#include <string_view>
#include <utility>

void reference_implementation(float x, char* buffer) { f2s_buffered(x, buffer); }
void reference_implementation(double x, char* buffer) { d2s_buffered(x, buffer); }
static void reference_implementation(float x, char* buffer) { f2s_buffered(x, buffer); }
static void reference_implementation(double x, char* buffer) { d2s_buffered(x, buffer); }

template <class Float, class... Args>
static bool test_all_shorter_interval_cases_impl(Args&&... args) {
Expand Down
4 changes: 2 additions & 2 deletions subproject/test/source/uniform_random_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
#include <string_view>
#include <utility>

void reference_implementation(float x, char* buffer) { f2s_buffered(x, buffer); }
void reference_implementation(double x, char* buffer) { d2s_buffered(x, buffer); }
static void reference_implementation(float x, char* buffer) { f2s_buffered(x, buffer); }
static void reference_implementation(double x, char* buffer) { d2s_buffered(x, buffer); }

template <class Float, class TypenameString, class... Args>
static bool uniform_random_test(std::size_t number_of_tests, TypenameString&& type_name_string,
Expand Down
4 changes: 2 additions & 2 deletions subproject/test/source/verify_cache_precision.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include <utility>
#include <vector>

std::ostream& operator<<(std::ostream& out, jkj::big_uint const& n) {
static std::ostream& operator<<(std::ostream& out, jkj::big_uint const& n) {
auto dec = n.to_decimal();
assert(!dec.empty());

Expand Down Expand Up @@ -66,7 +66,7 @@ struct analysis_result {
};

template <class FormatTraits>
bool analyze(std::ostream& out, std::size_t cache_bits) {
static bool analyze(std::ostream& out, std::size_t cache_bits) {
out << "e,bits_for_multiplication,bits_for_integer_check\n";

using impl = jkj::dragonbox::detail::impl<FormatTraits>;
Expand Down
12 changes: 6 additions & 6 deletions subproject/test/source/verify_log_computation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include <functional>
#include <iostream>

int floor_log10_pow2_precise(int e) {
static int floor_log10_pow2_precise(int e) {
using namespace jkj::dragonbox::detail::log;
bool is_negative;
if (e < 0) {
Expand All @@ -44,7 +44,7 @@ int floor_log10_pow2_precise(int e) {
return is_negative ? -k : k - 1;
}

int floor_log10_pow2_minus_log10_4_over_3_precise(int e) {
static int floor_log10_pow2_minus_log10_4_over_3_precise(int e) {
e -= 2;

if (e < 0) {
Expand Down Expand Up @@ -72,7 +72,7 @@ int floor_log10_pow2_minus_log10_4_over_3_precise(int e) {
}
}

int floor_log2_pow10_precise(int e) {
static int floor_log2_pow10_precise(int e) {
bool is_negative;
if (e < 0) {
is_negative = true;
Expand All @@ -93,7 +93,7 @@ int floor_log2_pow10_precise(int e) {
return is_negative ? -k : k - 1;
}

int floor_log5_pow2_precise(int e) {
static int floor_log5_pow2_precise(int e) {
bool is_negative;
if (e < 0) {
is_negative = true;
Expand All @@ -114,7 +114,7 @@ int floor_log5_pow2_precise(int e) {
return is_negative ? -k : k - 1;
}

int floor_log5_pow2_minus_log5_3_precise(int e) {
static int floor_log5_pow2_minus_log5_3_precise(int e) {
if (e >= 0) {
auto power_of_2 = jkj::big_uint::power_of_2(std::size_t(e));
auto power_of_5_times_3 = jkj::big_uint(3);
Expand Down Expand Up @@ -145,7 +145,7 @@ struct verify_result {

template <jkj::dragonbox::detail::log::multiply m, jkj::dragonbox::detail::log::subtract f,
jkj::dragonbox::detail::log::shift k>
verify_result verify(std::string_view name, std::function<int(int)> precise_calculator = nullptr) {
static verify_result verify(std::string_view name, std::function<int(int)> precise_calculator = nullptr) {
// Compute the maximum possible e
constexpr auto max_exponent_upper_bound =
std::numeric_limits<std::int32_t>::max() / std::int32_t(m);
Expand Down

0 comments on commit c6152a8

Please sign in to comment.