mirror of
https://github.com/google/benchmark.git
synced 2024-12-02 20:53:53 +00:00
9913418d32
* Allow AddRange to work with int64_t. Fixes #516 Also, tweak how we manage per-test build needs, and create a standard _gtest suffix for googletest to differentiate from non-googletest tests. I also ran clang-format on the files that I changed (but not the benchmark include or main src as they have too many clang-format issues). * Add benchmark_gtest to cmake * Set(Items|Bytes)Processed now take int64_t
34 lines
780 B
C++
34 lines
780 B
C++
#include <vector>
|
|
|
|
#include "../src/benchmark_register.h"
|
|
#include "gmock/gmock.h"
|
|
#include "gtest/gtest.h"
|
|
|
|
namespace {
|
|
|
|
TEST(AddRangeTest, Simple) {
|
|
std::vector<int> dst;
|
|
AddRange(&dst, 1, 2, 2);
|
|
EXPECT_THAT(dst, testing::ElementsAre(1, 2));
|
|
}
|
|
|
|
TEST(AddRangeTest, Simple64) {
|
|
std::vector<int64_t> dst;
|
|
AddRange(&dst, static_cast<int64_t>(1), static_cast<int64_t>(2), 2);
|
|
EXPECT_THAT(dst, testing::ElementsAre(1, 2));
|
|
}
|
|
|
|
TEST(AddRangeTest, Advanced) {
|
|
std::vector<int> dst;
|
|
AddRange(&dst, 5, 15, 2);
|
|
EXPECT_THAT(dst, testing::ElementsAre(5, 8, 15));
|
|
}
|
|
|
|
TEST(AddRangeTest, Advanced64) {
|
|
std::vector<int64_t> dst;
|
|
AddRange(&dst, static_cast<int64_t>(5), static_cast<int64_t>(15), 2);
|
|
EXPECT_THAT(dst, testing::ElementsAre(5, 8, 15));
|
|
}
|
|
|
|
} // end namespace
|