EMath++
Classes for mathematical concepts
Loading...
Searching...
No Matches
emath.cpp File Reference

This is the main test file of the emath library. It contains all the tests needed to assure that the library works properly. More...

#include <cassert>
#include <iostream>
#include "emath.h"
+ Include dependency graph for emath.cpp:

Go to the source code of this file.

Functions

bool vequal (const std::vector< std::complex< double > > v1, const std::vector< std::complex< double > > v2, bool t)
 Checks if two vectors with std::complex items have the same items, even if not in the same order.
 
int test_monomial ()
 Runs all the monomial class tests.
 
int test_polynomial ()
 Runs all the polynomial class tests.
 
int main ()
 Calls the monomial and polynomial tests.
 

Detailed Description

This is the main test file of the emath library. It contains all the tests needed to assure that the library works properly.

This file contains a main function that calls a function for the monomials and a function for the polynomials that test that every method works as it should.
If it doesn't then a message gets printed to the console describing the error. If this does happen open an issue on my github page.

Definition in file emath.cpp.

Function Documentation

◆ main()

int main ( )

Calls the monomial and polynomial tests.

Returns
(int) The sum of the test_monomial and test_polynomial function wich should be zero when all tests pass

Definition at line 224 of file emath.cpp.

References test_monomial(), and test_polynomial().

◆ test_monomial()

int test_monomial ( )

Runs all the monomial class tests.

Returns
(int) Returns 0 to specify to Meson that the tests finished correctly

Definition at line 28 of file emath.cpp.

References emth::Monomial::get_coeff(), emth::Monomial::get_degree(), emth::Monomial::get_expression(), and emth::Monomial::get_value().

◆ test_polynomial()

int test_polynomial ( )

Runs all the polynomial class tests.

Returns
(int) Returns 0 to specify to Meson that the tests finished correctly

Definition at line 115 of file emath.cpp.

References emth::Polynomial::get_degree(), emth::Polynomial::get_derivative(), emth::Polynomial::get_expression(), emth::Polynomial::get_integral(), emth::Polynomial::get_monomials(), emth::Polynomial::get_roots(), emth::Polynomial::get_value(), and vequal().

◆ vequal()

bool vequal ( const std::vector< std::complex< double > >  v1,
const std::vector< std::complex< double > >  v2,
bool  t 
)

Checks if two vectors with std::complex items have the same items, even if not in the same order.

Parameters
v1First vector to check
v2Second vector to check
tIf true compares the real parts when sorting, if false compares the imaginary parts
Returns
(bool) If they do or do not have the same items

Definition at line 18 of file emath.cpp.