LCOV - code coverage report
Current view: top level - tests/calc - t_calc.cpp (source / functions) Hit Total Coverage
Test: lcov.info Lines: 19 19 100.0 %
Date: 2024-05-13 05:06:06 Functions: 8 8 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*************************************************************************
       2             :  *
       3             :  *  Project
       4             :  *                        __  __ _______ _____  _  __
       5             :  *                       |  \/  |__   __|  __ \| |/ /
       6             :  *  ___  _ __   ___ _ __ | \  / |  | |  | |__) | ' /
       7             :  * / _ \| '_ \ / _ \ '_ \| |\/| |  | |  |  ___/|  <
       8             :  *| (_) | |_) |  __/ | | | |  | |  | |  | |    | . \
       9             :  * \___/| .__/ \___|_| |_|_|  |_|  |_|  |_|    |_|\_\
      10             :  *      | |
      11             :  *      |_|
      12             :  *
      13             :  *
      14             :  * Copyright (C) Akiel Aries, <akiel@akiel.org>, et al.
      15             :  *
      16             :  * This software is licensed as described in the file LICENSE, which
      17             :  * you should have received as part of this distribution. The terms
      18             :  * among other details are referenced in the official documentation
      19             :  * seen here : https://akielaries.github.io/openGPMP/ along with
      20             :  * important files seen in this project.
      21             :  *
      22             :  * You may opt to use, copy, modify, merge, publish, distribute
      23             :  * and/or sell copies of the Software, and permit persons to whom
      24             :  * the Software is furnished to do so, under the terms of the
      25             :  * LICENSE file. As this is an Open Source effort, all implementations
      26             :  * must be of the same methodology.
      27             :  *
      28             :  *
      29             :  *
      30             :  * This software is distributed on an AS IS basis, WITHOUT
      31             :  * WARRANTY OF ANY KIND, either express or implied.
      32             :  *
      33             :  ************************************************************************/
      34             : 
      35             : /*
      36             :  * Testing Calculus Operations
      37             :  */
      38             : #include <gtest/gtest.h>
      39             : #include <limits.h>
      40             : #include <openGPMP/calculus/differential.hpp>
      41             : #include <string>
      42             : 
      43             : using ::testing::DoubleLE;
      44             : using ::testing::FloatLE;
      45             : using ::testing::InitGoogleTest;
      46             : 
      47             : namespace {
      48             : 
      49           4 : TEST(DifferentialTests, AddTerm) {
      50           1 :     gpmp::Differential poly;
      51           1 :     poly.add_term(3, 2);
      52           1 :     poly.add_term(2, 1);
      53           1 :     poly.add_term(1, 0);
      54             : 
      55           1 :     ASSERT_EQ(poly.terms.size(), 3);
      56             : 
      57             :     // Add more assertions based on the specific behavior you expect
      58           1 : }
      59             : 
      60           4 : TEST(DifferentialTests, PowerRule) {
      61           1 :     gpmp::Differential poly;
      62           1 :     poly.add_term(3, 2);
      63           1 :     poly.add_term(2, 1);
      64           1 :     poly.add_term(1, 0);
      65             : 
      66           1 :     gpmp::Differential result = poly.power_rule();
      67             : 
      68             :     // Assert the result based on the expected derivative
      69           1 :     ASSERT_EQ(result.terms.size(), 2);
      70           1 :     ASSERT_EQ(result.terms[0].coefficient, 6);
      71           1 :     ASSERT_EQ(result.terms[0].exponent, 1);
      72           1 :     ASSERT_EQ(result.terms[1].coefficient, 2);
      73           1 :     ASSERT_EQ(result.terms[1].exponent, 0);
      74           1 : }
      75             : 
      76             : } // namespace

Generated by: LCOV version 1.14