Thrill  0.1
tests/common/stats_counter_test.cpp
/*******************************************************************************
* tests/common/stats_counter_test.cpp
*
* Part of Project Thrill - http://project-thrill.org
*
* Copyright (C) 2015 Timo Bingmann <[email protected]>
*
* All rights reserved. Published under the BSD-2 license in the LICENSE file.
******************************************************************************/
#include <gtest/gtest.h>
using namespace thrill::common;
TEST(StatsCounter, Test1) {
counter++;
++counter;
counter += 40;
ASSERT_EQ(counter.Real(), true);
ASSERT_EQ(counter, 42);
StatsCounter<long, true> counter2 = counter;
counter2.set_max(40);
ASSERT_EQ(counter2, 42);
}
TEST(StatsCounter, Test2) {
counter++;
++counter;
counter += 40;
ASSERT_EQ(counter.Real(), false);
ASSERT_EQ(counter, 0);
StatsCounter<long, false> counter2 = counter;
counter2.set_max(40);
ASSERT_EQ(counter2, 0);
}
namespace thrill {
namespace common {
// forced instantiations
template class StatsCounter<long, true>;
} // namespace common
} // namespace thrill
/******************************************************************************/