mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
First test case implemented.
This is just a stub test case to show how a test case should be implemented. every 'private slot' on the test classes will be automatically executed when you run 'make test' on the terminal, and a report will be generated with a failure / success. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
907d8b8fbb
commit
019edd065f
3 changed files with 29 additions and 0 deletions
|
@ -114,3 +114,6 @@ ADD_DEPENDENCIES(subsurface_interface subsurface_generated_ui)
|
|||
ADD_DEPENDENCIES(subsurface_generated_ui version)
|
||||
|
||||
ENABLE_TESTING()
|
||||
ADD_EXECUTABLE( TestUnitConversion tests/testunitconversion.cpp )
|
||||
TARGET_LINK_LIBRARIES( TestUnitConversion ${QT_LIBRARIES})
|
||||
ADD_TEST( NAME TestUnitConversion COMMAND TestUnitConversion)
|
14
tests/testunitconversion.cpp
Normal file
14
tests/testunitconversion.cpp
Normal file
|
@ -0,0 +1,14 @@
|
|||
#include "testunitconversion.h"
|
||||
#include "dive.h"
|
||||
|
||||
void TestUnitConversion::testUnitConversions()
|
||||
{
|
||||
QCOMPARE(IS_FP_SAME(grams_to_lbs(1000), 2.20459), true);
|
||||
QCOMPARE(lbs_to_grams(1), 454);
|
||||
QCOMPARE(IS_FP_SAME(ml_to_cuft(1000), 0.0353147), true);
|
||||
QCOMPARE(IS_FP_SAME(cuft_to_l(1), 28.3168), true);
|
||||
QCOMPARE(IS_FP_SAME(mm_to_feet(1000), 3.28084), true);
|
||||
QCOMPARE(feet_to_mm(1), (long unsigned int) 305);
|
||||
}
|
||||
|
||||
QTEST_MAIN(TestUnitConversion)
|
12
tests/testunitconversion.h
Normal file
12
tests/testunitconversion.h
Normal file
|
@ -0,0 +1,12 @@
|
|||
#ifndef TESTUNITCONVERSION_H
|
||||
#define TESTUNITCONVERSION_H
|
||||
|
||||
#include <QtTest>
|
||||
|
||||
class TestUnitConversion : public QObject{
|
||||
Q_OBJECT
|
||||
private slots:
|
||||
void testUnitConversions();
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in a new issue