Autopysta
Loading...
Searching...
No Matches
test Class Reference

A utility class that provides common testing functions. More...

#include <misc.h>

Static Public Member Functions

static bool range_inc (double number, double min, double max)
 Check if a number is within an inclusive range.
 
template<typename T , typename A >
static bool length (std::vector< T, A > v, int l)
 Check if a vector has a specific length.
 

Detailed Description

A utility class that provides common testing functions.

This class contains utility functions for common tasks like checking if a number falls within a range and checking the length of a vector. It is designed to be a lightweight helper for various validation tasks.

Member Function Documentation

◆ length()

template<typename T , typename A >
static bool test::length ( std::vector< T, A > v,
int l )
static

Check if a vector has a specific length.

This method checks whether the size of the given vector matches the specified length. It is a templated function, allowing it to work with vectors containing any data type.

Template Parameters
TThe type of the elements in the vector.
AThe allocator type for the vector (typically std::allocator).
Parameters
vThe vector to be checked.
lThe required length of the vector.
Returns
True if the vector size matches the specified length, false otherwise.

◆ range_inc()

static bool test::range_inc ( double number,
double min,
double max )
static

Check if a number is within an inclusive range.

This method checks whether a given number lies between a minimum and a maximum value (both bounds inclusive).

Parameters
numberThe number to be checked.
minThe minimum allowable value.
maxThe maximum allowable value.
Returns
True if the number lies within the range, false otherwise.

The documentation for this class was generated from the following file: