Skip to content

Commit

Permalink
Change namespace from contour::termbench to termbench
Browse files Browse the repository at this point in the history
  • Loading branch information
christianparpart committed Mar 18, 2024
1 parent cc14611 commit 6dca719
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 29 deletions.
18 changes: 6 additions & 12 deletions libtermbench/termbench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
using namespace std::chrono;
using namespace std::string_view_literals;

namespace contour::termbench
namespace termbench
{

namespace
Expand Down Expand Up @@ -132,9 +132,9 @@ void Benchmark::summarize(std::ostream& os)
os << std::format(" data size: {}\n", sizeStr(static_cast<double>(testSizeMB_ * 1024 * 1024)));
}

} // namespace contour::termbench
} // namespace termbench

namespace contour::termbench::tests
namespace termbench::tests
{

namespace
Expand Down Expand Up @@ -246,10 +246,7 @@ namespace

TerminalSize terminalSize;

void setup(TerminalSize size) noexcept override
{
terminalSize = size;
}
void setup(TerminalSize size) noexcept override { terminalSize = size; }

void run(Buffer& _sink) noexcept override
{
Expand Down Expand Up @@ -279,10 +276,7 @@ namespace

TerminalSize terminalSize;

void setup(TerminalSize size) noexcept override
{
terminalSize = size;
}
void setup(TerminalSize size) noexcept override { terminalSize = size; }

void run(Buffer& _sink) noexcept override
{
Expand Down Expand Up @@ -416,4 +410,4 @@ std::unique_ptr<Test> sgrbg_line(size_t N)
return std::make_unique<Line>(name, text);
}

} // namespace contour::termbench::tests
} // namespace termbench::tests
8 changes: 4 additions & 4 deletions libtermbench/termbench.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <string_view>
#include <vector>

namespace contour::termbench
namespace termbench
{

struct TerminalSize
Expand Down Expand Up @@ -118,10 +118,10 @@ class Benchmark
std::vector<Result> results_;
};

} // namespace contour::termbench
} // namespace termbench

// Holds a set of pre-defined terminal benchmark tests.
namespace contour::termbench::tests
namespace termbench::tests
{
std::unique_ptr<Test> many_lines();
std::unique_ptr<Test> long_lines();
Expand All @@ -131,4 +131,4 @@ std::unique_ptr<Test> binary();
std::unique_ptr<Test> ascii_line(size_t);
std::unique_ptr<Test> sgr_line(size_t);
std::unique_ptr<Test> sgrbg_line(size_t);
} // namespace contour::termbench::tests
} // namespace termbench::tests
26 changes: 13 additions & 13 deletions tb/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ using namespace std::placeholders;

#define STDOUT_FASTPATH_FD 3

using contour::termbench::TerminalSize;
using termbench::TerminalSize;

namespace
{
Expand Down Expand Up @@ -162,23 +162,23 @@ BenchSettings parseArguments(int argc, char const* argv[], TerminalSize const& i
return settings;
}

void addTestsToBenchmark(contour::termbench::Benchmark& tb, BenchSettings const& settings)
void addTestsToBenchmark(termbench::Benchmark& tb, BenchSettings const& settings)
{
tb.add(contour::termbench::tests::many_lines());
tb.add(contour::termbench::tests::long_lines());
tb.add(contour::termbench::tests::sgr_fg_lines());
tb.add(contour::termbench::tests::sgr_fgbg_lines());
tb.add(contour::termbench::tests::binary());
tb.add(termbench::tests::many_lines());
tb.add(termbench::tests::long_lines());
tb.add(termbench::tests::sgr_fg_lines());
tb.add(termbench::tests::sgr_fgbg_lines());
tb.add(termbench::tests::binary());

if (settings.columnByColumn)
{
auto const maxColumns { settings.requestedTerminalSize.columns * 2u };
for (size_t i = 0; i < maxColumns; ++i)
tb.add(contour::termbench::tests::ascii_line(i));
tb.add(termbench::tests::ascii_line(i));
for (size_t i = 0; i < maxColumns; ++i)
tb.add(contour::termbench::tests::sgr_line(i));
tb.add(termbench::tests::sgr_line(i));
for (size_t i = 0; i < maxColumns; ++i)
tb.add(contour::termbench::tests::sgrbg_line(i));
tb.add(termbench::tests::sgrbg_line(i));
}
}

Expand Down Expand Up @@ -229,9 +229,9 @@ int main(int argc, char const* argv[])
: settings.stdoutFastPath ? chunkedWriteToStdout<STDOUT_FASTPATH_FD>
: chunkedWriteToStdout<STDOUT_FILENO>;

contour::termbench::Benchmark tb { writer,
settings.testSizeMB, // MB per test
settings.requestedTerminalSize };
termbench::Benchmark tb { writer,
settings.testSizeMB, // MB per test
settings.requestedTerminalSize };

addTestsToBenchmark(tb, settings);

Expand Down

0 comments on commit 6dca719

Please sign in to comment.