FCF 2.0 development in progress...
> > > > > >
[News] [C++ Libraries API] [C++ Downloads] [Donate to the project] [Contacts]

max() method from fcf::NTest::HistogramBasic class

TItem max() const

Class: fcf::NTest::HistogramBasic

Package: fcfTest

File: test.hpp

Available from version: 1.2.5

Returns the maximum value recorded in the histogram.

The max method returns the highest value that has been added to the histogram via the append method.

Result
TItem
- The maximum value recorded.

Example: Retrieving Maximum Value

Simple example of getting the maximum value.

#define FCF_TEST_IMPLEMENTATION #include <fcfTest/test.hpp> #include <iostream> FCF_TEST_DEFINE("HistogramDemo", "MaxTest", "GetMax") { fcf::NTest::HistogramBasic<int> hist; hist.append(50); hist.append(10); hist.append(100); int maxVal = hist.max(); fcf::NTest::log() << "Max: " << maxVal << std::endl; FCF_TEST(maxVal == 100); } int main(int a_argc, char* a_argv[]) { bool error = false; fcf::NTest::cmdRun(a_argc, a_argv, fcf::NTest::CRM_RUN, &error); return error ? 1 : 0; }

Output:

Performing the test: "HistogramDemo" -> "MaxTest" -> "GetMax" ... > Max: 100 [SUCCESS] Test completed successfully (0.000`023`809 sec) [SUCCESS] All tests were completed. Tests: 1 passed, 0 failed, 0 skipped, 1 total Duration: 0.000`023`809 sec