Created
October 4, 2017 19:34
-
-
Save dimka11/e2fd6cde0a7181fafbae5c18481782b2 to your computer and use it in GitHub Desktop.
test modf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "stdafx.h" | |
#include "CppUnitTest.h" | |
#include <iostream> // для оператора cout | |
#include <cmath> // для функции modf | |
using namespace Microsoft::VisualStudio::CppUnitTestFramework; | |
namespace modfUnit | |
{ | |
TEST_CLASS(UnitTest1) | |
{ | |
public: | |
TEST_METHOD(modf_with_3_14) | |
{ | |
double val = 3.14159265; | |
double fractpart;// дробная часть | |
double intpart; // целая часть | |
fractpart = modf(val, &intpart); // отделить дробную часть от целой | |
double epsilon = 1.0e-15; | |
double Testfractpart = 0.14159265; | |
double Testintpart = 3; | |
bool CheckIntPart; | |
bool CheckFractPart; | |
(fabs(intpart - Testintpart) < epsilon) ? CheckIntPart = true : CheckIntPart = false; | |
(fabs(fractpart - Testfractpart) < epsilon) ? CheckFractPart = true : CheckFractPart = false; | |
Assert::IsTrue(CheckIntPart & CheckFractPart, L"Its smt wrong"); | |
// TODO: Your test code here | |
} | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment