Skip to content

Commit 89c0fd0

Browse files
committed
another part of unit tests
1 parent 095de0a commit 89c0fd0

File tree

8 files changed

+1823
-0
lines changed

8 files changed

+1823
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
QT -= gui
2+
3+
CONFIG += c++11 console
4+
5+
CONFIG -= app_bundle
6+
7+
# The following define makes your compiler emit warnings if you use
8+
# any Qt feature that has been marked deprecated (the exact warnings
9+
# depend on your compiler). Please consult the documentation of the
10+
# deprecated API in order to know how to port your code away from it.
11+
DEFINES += QT_DEPRECATED_WARNINGS
12+
13+
# You can also make your code fail to compile if it uses deprecated APIs.
14+
# In order to do so, uncomment the following line.
15+
# You can also select to disable deprecated APIs only up to a certain version of Qt.
16+
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
17+
18+
!include( ../thirdpartylibs.pri ) {
19+
error( "No ../thirdpartylibs.pri file found" )
20+
}
21+
22+
INCLUDEPATH += $$INPRO__THIRD_PARTY_LIBS_ROOT/openexr-2.4.0/IlmBase/Imath/
23+
INCLUDEPATH += $$INPRO__THIRD_PARTY_LIBS_ROOT/openexr-2.4.0/buildhere/IlmBase/config/ #for IlmBaseConfig.h
24+
25+
INCLUDEPATH += $$INPRO__THIRD_PARTY_LIBS_ROOT/openexr-2.4.0/IlmBase/Iex/ #for IexBaseExc.h
26+
INCLUDEPATH += $$INPRO__THIRD_PARTY_LIBS_ROOT/oiio-RB-2.1/src/include/
27+
INCLUDEPATH += $$INPRO__THIRD_PARTY_LIBS_ROOT/oiio-RB-2.1/buildhere/include/
28+
29+
INCLUDEPATH += ../../application/logic
30+
INCLUDEPATH += ../../application
31+
32+
HEADERS += \
33+
../../application/logic/model/dialogProfilsCurves/landmarks.h \
34+
../../application/logic/toolbox/toolbox_math.h \
35+
../../application/logic/model/core/S_Segment.h \
36+
37+
SOURCES += \
38+
../../application/logic/model/dialogProfilsCurves/landmarks.cpp \
39+
../../application/logic/toolbox/toolbox_math.cpp \
40+
../../application/logic/model/core/S_Segment.cpp \
41+
\
42+
test_landmarkComputation.cpp \
43+
44+
# Default rules for deployment.
45+
qnx: target.path = /tmp/$${TARGET}/bin
46+
else: unix:!android: target.path = /opt/$${TARGET}/bin
47+
!isEmpty(target.path): INSTALLS += target
Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
#include <QDebug>
2+
3+
#include "../../application/logic/model/dialogProfilsCurves/landmarks.h"
4+
5+
void test_landmarkComputation();
6+
7+
int main(int argc, char *argv[]) {
8+
9+
test_landmarkComputation();
10+
11+
}
12+
13+
void test_landmarkComputation() {
14+
15+
double yLandmark_rangeTest[9][2]= {
16+
{ 0 , 100 },
17+
{ -0.080e-2 , 0.0280e-2},
18+
{ -66.6632 , -60.4132 },
19+
{ -66.6632e-3, -60.4132e-5},
20+
{ 66.6632e1 , 60.4132e4 },
21+
{ 10.0 , 13000.0 },
22+
{ 1.23 , 14.5 },
23+
{12345 , 123456 },
24+
{123456 , 1234567 }
25+
};
26+
27+
for (int i = 0; i < 9; i++) {
28+
LandmarkInRange yLM;
29+
30+
qDebug() << "______________________";
31+
qDebug() << "y range: " << yLandmark_rangeTest[i][0] << ", " << yLandmark_rangeTest[i][1];
32+
33+
yLM.set(yLandmark_rangeTest[i][0], yLandmark_rangeTest[i][1]);
34+
35+
yLM.compute_fixedSteps_bigDiv_2_100__smallDiv_5();
36+
37+
QVector<double> qvectYBigLandMarks = yLM.getBigLandMarksRef();//###LP check that no copy constructor used
38+
if (!qvectYBigLandMarks.isEmpty()) {
39+
40+
QVector<QString> qvect_qstrYBigLm = valuesToPowerString_withUniformPower(qvectYBigLandMarks);
41+
42+
//
43+
//double powerOfTen_ofBigLandMark_minValue = powerOfTen(qvectYBigLandMarks.first());
44+
//double powerOfTen_ofBigLandMark_maxValue = powerOfTen(qvectYBigLandMarks.last());
45+
//
46+
//for(auto bigLm: qvectYBigLandMarks) {
47+
// QString strYBigLm = valueToPoweredString(bigLm,
48+
// powerOfTen_ofBigLandMark_minValue,
49+
// powerOfTen_ofBigLandMark_maxValue);
50+
// qDebug() << strYBigLm;
51+
//}
52+
//
53+
}
54+
}
55+
56+
57+
double xLandmark_rangeTest[60][2]= {
58+
{ -1, 1 },
59+
{ -2, 2 },
60+
{ -3, 3 },
61+
{ -4, 4 },
62+
{ -5, 5 },
63+
{ -6, 6 },
64+
{ -7, 7 },
65+
{ -8, 8 },
66+
{ -9, 9 },
67+
{ -10, 10 },
68+
{ -12, 12 },
69+
{ -15, 15 },
70+
{ -21, 21 },
71+
{ -22, 22 },
72+
{ -50, 50 },
73+
{ -75, 75 },
74+
{ -100, 100 },
75+
{ -102, 102 },
76+
{ -136, 136 },
77+
{ -200, 200 },
78+
{ -236, 236 },
79+
{ -250, 250 },
80+
{ -254, 254 },
81+
{ -255, 255 },
82+
{ -5000, 5000 },
83+
{ -7000, 7000 },
84+
{ -8500, 8500 },
85+
{ -10000, 10000 },
86+
87+
{ -2, 0 },
88+
{ -1, 0 },
89+
{ -3, 1 },
90+
{ -4, -2 },
91+
{ -5, -1 },
92+
{ -6, 8 },
93+
{ -7, 1 },
94+
{ -8, 1 },
95+
{ -9, 1 },
96+
{ -10, -3 },
97+
{ -12, 1 },
98+
{ -15, 5 },
99+
{ -21, 1 },
100+
{ -22, 2 },
101+
{ -50, 0 },
102+
{ -75, 5 },
103+
{ -100, 10 },
104+
{ -102, 12 },
105+
{ -136, 216 },
106+
{ -200, 420 },
107+
{ -236, -126 },
108+
{ -250, -20 },
109+
{ -254, -242 },
110+
{ -255, 25 },
111+
{ -5000, 500 },
112+
{ -7000,-5000 },
113+
{ -8500, 0 },
114+
{ -10000, 8000 },
115+
116+
{ -175, 175 },
117+
{ -319, 319 },
118+
{ -3333, 3333 },
119+
{ -175, 175 }
120+
};
121+
122+
for (int i = 0; i < 60; i++) {
123+
qDebug() << "______________________";
124+
qDebug() << "x range: " << xLandmark_rangeTest[i][0] << ", " << xLandmark_rangeTest[i][1];
125+
LandmarkInRange xLM;
126+
xLM.set(xLandmark_rangeTest[i][0], xLandmark_rangeTest[i][1]);
127+
xLM.compute_fixedSteps_min0max_with_intBigDiv_2_3_4_5__intSmallDiv_v2();
128+
129+
QVector<double> qvectXBigLandMarks = xLM.getBigLandMarksRef();//###LP check that no copy constructor used
130+
if (!qvectXBigLandMarks.isEmpty()) {
131+
QVector<QString> qvect_qstrXBigLm = valuesToPowerString_withUniformPower(qvectXBigLandMarks);
132+
}
133+
}
134+
135+
136+
137+
/*
138+
_yLM.set(0.005552, .15383);
139+
//_yLM.compute(5.0, 5.0,false);
140+
_yLM.compute_fixedStep();
141+
142+
_yLM.set(0.5552, 15.383);
143+
_yLM.compute_fixedStep();
144+
*/
145+
146+
/*_yLM.set(0, 8);
147+
_yLM.compute_fixedStep();
148+
149+
_yLM.set(0, 9);
150+
_yLM.compute_fixedStep();
151+
152+
_yLM.set(0, 10);
153+
_yLM.compute_fixedStep();
154+
155+
_yLM.set(5, 15);
156+
_yLM.compute_fixedStep();
157+
158+
_yLM.set(100, 108);
159+
_yLM.compute_fixedStep();
160+
161+
_yLM.set(100, 118);
162+
_yLM.compute_fixedStep();
163+
164+
_yLM.set(-8, +4);
165+
_yLM.compute_fixedStep();
166+
*/
167+
168+
169+
}
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
QT += core
2+
QT -= gui
3+
4+
CONFIG += c++14 console
5+
CONFIG -= app_bundle
6+
7+
# The following define makes your compiler emit warnings if you use
8+
# any feature of Qt which has been marked as deprecated (the exact warnings
9+
# depend on your compiler). Please consult the documentation of the
10+
# deprecated API in order to know how to port your code away from it.
11+
DEFINES += QT_DEPRECATED_WARNINGS
12+
13+
# You can also make your code fail to compile if you use deprecated APIs.
14+
# In order to do so, uncomment the following line.
15+
# You can also select to disable deprecated APIs only up to a certain version of Qt.
16+
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
17+
18+
!include( ../thirdpartylibs.pri ) {
19+
error( "No ../thirdpartylibs.pri file found" )
20+
}
21+
22+
INCLUDEPATH += $$INPRO__THIRD_PARTY_LIBS_ROOT/oiio-RB-2.1/src/include/
23+
24+
INCLUDEPATH += $$INPRO__THIRD_PARTY_LIBS_ROOT/oiio-RB-2.1/buildhere/include/
25+
26+
INCLUDEPATH += $$INPRO__THIRD_PARTY_LIBS_ROOT/oiio-RB-2.1/ext/fmt/include
27+
28+
29+
LIBS += $$INPRO__THIRD_PARTY_LIBS_ROOT/oiio-RB-2.1/buildhere/lib/libOpenImageIO.a
30+
31+
32+
#openexr header installed here:
33+
INCLUDEPATH += "/usr/local/include/"
34+
35+
36+
INCLUDEPATH += $$INPRO__THIRD_PARTY_LIBS_ROOT/openexr-2.4.0/IlmBase/Imath/
37+
INCLUDEPATH += $$INPRO__THIRD_PARTY_LIBS_ROOT/openexr-2.4.0/buildhere/IlmBase/config/ #for IlmBaseConfig.h
38+
INCLUDEPATH += $$INPRO__THIRD_PARTY_LIBS_ROOT/openexr-2.4.0/IlmBase/Iex/ #for IexBaseExc.h
39+
DEPENDPATH += $$INPRO__THIRD_PARTY_LIBS_ROOT/openexr-2.4.0/buildhere/IlmBase/Imath/
40+
41+
LIBS += -lz -ldl
42+
43+
#static lib linking:
44+
LIBS += $$INPRO__THIRD_PARTY_LIBS_ROOT/openexr-2.4.0/buildhere/IlmBase/Half/libHalf-2_4.a
45+
LIBS += $$INPRO__THIRD_PARTY_LIBS_ROOT/openexr-2.4.0/buildhere/OpenEXR/IlmImfUtil/libIlmImfUtil-2_4.a
46+
LIBS += $$INPRO__THIRD_PARTY_LIBS_ROOT/openexr-2.4.0/buildhere/OpenEXR/IlmImf/libIlmImf-2_4.a
47+
LIBS += $$INPRO__THIRD_PARTY_LIBS_ROOT/openexr-2.4.0/buildhere/IlmBase/IlmThread/libIlmThread-2_4.a
48+
LIBS += $$INPRO__THIRD_PARTY_LIBS_ROOT/openexr-2.4.0/buildhere/IlmBase/Iex/libIex-2_4.a
49+
LIBS += $$INPRO__THIRD_PARTY_LIBS_ROOT/openexr-2.4.0/buildhere/IlmBase/Imath/libImath-2_4.a
50+
LIBS += $$INPRO__THIRD_PARTY_LIBS_ROOT/openexr-2.4.0/buildhere/IlmBase/IexMath/libIexMath-2_4.a
51+
52+
LIBS += $$INPRO__THIRD_PARTY_LIBS_ROOT/boost170installhere/lib/libboost_filesystem.a
53+
LIBS += $$INPRO__THIRD_PARTY_LIBS_ROOT/boost170installhere/lib/libboost_system.a
54+
LIBS += $$INPRO__THIRD_PARTY_LIBS_ROOT/boost170installhere/lib/libboost_thread.a
55+
LIBS += $$INPRO__THIRD_PARTY_LIBS_ROOT/boost170installhere/lib/libboost_chrono.a
56+
LIBS += $$INPRO__THIRD_PARTY_LIBS_ROOT/boost170installhere/lib/libboost_date_time.a
57+
LIBS += $$INPRO__THIRD_PARTY_LIBS_ROOT/boost170installhere/lib/libboost_atomic.a
58+
59+
LIBS += -lpthread
60+
61+
LIBS += $$INPRO__THIRD_PARTY_LIBS_ROOT/libpng-1.6.37/.libs/libpng16.a
62+
63+
LIBS += $$INPRO__THIRD_PARTY_LIBS_ROOT/jpeg-8b/.libs/libjpeg.a
64+
65+
#/usr/local/lib
66+
LIBS +=-ltiff
67+
68+
INCLUDEPATH += ../../application
69+
INCLUDEPATH += ../../application/logic
70+
71+
HEADERS += \
72+
../../application/logic/io/PixelPicker.h \
73+
../../application/logic/io/InputImageFormatChecker.h \
74+
../../application/logic/vecttype.h \
75+
../../application/logic/toolbox/toolbox_json.h \
76+
../../application/logic/toolbox/toolbox_pathAndFile.h \
77+
../../application/logic/toolbox/toolbox_conversion.h \
78+
../../application/logic/toolbox/toolbox_math.h \
79+
80+
SOURCES += \
81+
../../application/logic/io/PixelPicker.cpp \
82+
../../application/logic/io/InputImageFormatChecker.cpp \
83+
../../application/logic/vecttype.cpp \
84+
../../application/logic/toolbox/toolbox_json.cpp \
85+
../../application/logic/toolbox/toolbox_pathAndFile.cpp \
86+
../../application/logic/toolbox/toolbox_conversion.cpp \
87+
../../application/logic/toolbox/toolbox_math.cpp \
88+
test_pixelPicker.cpp
89+
90+
# Default rules for deployment.
91+
qnx: target.path = /tmp/$${TARGET}/bin
92+
else: unix:!android: target.path = /opt/$${TARGET}/bin
93+
!isEmpty(target.path): INSTALLS += target

0 commit comments

Comments
 (0)