Functions
hypot_test.cc File Reference
#include "catch2/catch.hpp"
#include <cmath>
#include <limits>
#include "cetlib/hypot.h"

Go to the source code of this file.

Functions

 TEST_CASE ("Basic test")
 
 TEST_CASE ("NaN test")
 
 TEST_CASE ("Inf test")
 

Function Documentation

TEST_CASE ( "Basic test )

Definition at line 10 of file hypot_test.cc.

11 {
12  CHECK(hypot(5, 12) == 13);
13  CHECK(hypot(.5, 1.2) == Approx(1.3).epsilon(0.0001));
14  CHECK(hypot(.05L, .12L) == Approx(.13L).epsilon(0.0001L));
15 }
std::enable_if_t< std::is_arithmetic_v< T >, T > hypot(T x, T y)
Definition: hypot.h:60
TEST_CASE ( "NaN test )

Definition at line 17 of file hypot_test.cc.

18 {
19  CHECK(std::isnan(hypot(std::numeric_limits<double>::quiet_NaN(), 1.2)));
20  CHECK(std::isnan(hypot(3.1415926, std::numeric_limits<double>::quiet_NaN())));
21 }
std::enable_if_t< std::is_arithmetic_v< T >, T > hypot(T x, T y)
Definition: hypot.h:60
TEST_CASE ( "Inf test )

Definition at line 23 of file hypot_test.cc.

24 {
25  CHECK(std::isinf(hypot(std::numeric_limits<double>::infinity(), 1.2)));
26  CHECK(std::isinf(hypot(3.1415926, std::numeric_limits<double>::infinity())));
27 
28  CHECK(std::isinf(hypot(-std::numeric_limits<double>::infinity(), 1.2)));
29  CHECK(std::isinf(hypot(3.1415926, -std::numeric_limits<double>::infinity())));
30 }
std::enable_if_t< std::is_arithmetic_v< T >, T > hypot(T x, T y)
Definition: hypot.h:60