ultimatum424 / OOP

0 stars 0 forks source link

Замечания по программе Vector 3d #7

Open alexey-malov opened 7 years ago

alexey-malov commented 7 years ago
   vector3d tests
2>      Vector3D gets value from constructor
2>      Vector3D reutrn length vector
2>      Vector3D have unary operators plus and minus
2>      Vector3D have binary operators plus
2>      Vector3D have binary operators minus
2>      Vector3D can multiply vector and scalar
2>      Vector3D can division vector and scalar
2>      Vector3D have operation equality and inequality
2>      Vector3D can multiply vectors
2>      Vector3D have scalar multiplication vectors
2>      Vector3D have operation normalizion
2>      Vector3D can read data from stream
2>      Vector3D can output data to stream
alexey-malov commented 7 years ago
alexey-malov commented 7 years ago
alexey-malov commented 7 years ago

Следующая проверка не проходит

    BOOST_CHECK(CVector3D(1, 0, 0) != CVector3D(1, 1, 0));
alexey-malov commented 7 years ago
alexey-malov commented 7 years ago
C:\teaching\2016\old\veschev\OOP\LAB5\VECTOR\tests\tests.vcxproj(67,5): The imported project "C:\teaching\2016\old\veschev\OOP\LAB5\VECTOR\tests\boost.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
alexey-malov commented 7 years ago

В английском обратный порядок слов. длина вектора - vector length, а не length vector

alexey-malov commented 7 years ago
alexey-malov commented 7 years ago
    BOOST_CHECK_EQUAL(Rounding(vector.GetLength()), 15.895);
alexey-malov commented 7 years ago
    CVector3D& operator*=(const float scalar);

    CVector3D& operator/=(const float scalar);

CVector3D const operator*(const CVector3D & vector, const float scalar);

CVector3D const operator*(const float scalar, const CVector3D & vector);

CVector3D const operator/(const CVector3D & vector, const float scalar);
alexey-malov commented 7 years ago
bool const operator==(const CVector3D & v1, const CVector3D & v2)
{
/*
    if (abs(v1.x - v2.x) > DBL_EPSILON)
    {
        return false;
    }
*/
    if (abs(v1.y - v2.y) > DBL_EPSILON)
    {
        return false;
    }
/*
    if (abs(v1.z - v2.z) > DBL_EPSILON)
    {
        return false;
    }
*/
    return true;
}
alexey-malov commented 7 years ago
BOOST_AUTO_TEST_CASE(Vector3D_can_read_data_from_stream)
{
    CVector3D vector2 = { 10, 2, 3 };
    std::stringbuf stringBuff("5 2 1");
    std::istream is(&stringBuff);
    is >> vector2;
    CVector3D rightVector = { 5, 2, 1 };
    BOOST_CHECK(vector2 == rightVector);
}

BOOST_AUTO_TEST_CASE(Vector3D_can_output_data_to_stream)
{
    CVector3D vector = { 5.26, 0, -15 };
    output_test_stream output;
    output << vector;
    BOOST_TEST(!output.is_empty(false));
    BOOST_TEST(output.is_equal("5.26, 0, -15"));
}
alexey-malov commented 7 years ago
1>c:\teaching\2016\old\veschev\oop\lab5\vector\vector\vector.cpp(16): warning C4101: 'a': unreferenced local variable
1>  Generating Code...
alexey-malov commented 7 years ago
2>c:/teaching/2016/old/veschev/oop/lab5/vector/tests/vector3dtests.cpp(158): error : in "Vector3D/can_read_data_from_stream": check vector2 == rightVector has failed
2>      can output data to stream
2>c:/teaching/2016/old/veschev/oop/lab5/vector/tests/vector3dtests.cpp(167): error : in "Vector3D/can_output_data_to_stream": check output.is_equal("5.26, 0, -15") has failed. Output content: "5.26, 0, -15