Skip to content

Commit

Permalink
Extend Iex test coverage (#1364)
Browse files Browse the repository at this point in the history
* Add tests for throwErrnoExc

And fixed bug in throwing ENOCSI

Signed-off-by: Cary Phillips <cary@ilm.com>

* testMathExc

Signed-off-by: Cary Phillips <cary@ilm.com>

* testMathExc

Signed-off-by: Cary Phillips <cary@ilm.com>

* typeinfo

Signed-off-by: Cary Phillips <cary@ilm.com>

* fix test2

Signed-off-by: Cary Phillips <cary@ilm.com>

* test3

Signed-off-by: Cary Phillips <cary@ilm.com>

---------

Signed-off-by: Cary Phillips <cary@ilm.com>
  • Loading branch information
cary-ilm committed Mar 20, 2023
1 parent e302b80 commit 673205a
Show file tree
Hide file tree
Showing 8 changed files with 748 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/lib/Iex/IexThrowErrnoExc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ throwErrnoExc (const std::string& text, int errnum)
case EUNATCH: throw EunatchExc (tmp);
#endif

#if defined(ENOSCI)
#if defined(ENOCSI)
case ENOCSI: throw EnocsiExc (tmp);
#endif

Expand Down
4 changes: 4 additions & 0 deletions src/test/IexTest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ add_executable(IexTest
main.cpp
testBaseExc.cpp
testBaseExc.h
testMathExc.cpp
testMathExc.h
mathFuncs.cpp
mathFuncs.h
)

target_link_libraries(IexTest OpenEXR::Iex)
Expand Down
2 changes: 2 additions & 0 deletions src/test/IexTest/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#endif

#include <testBaseExc.h>
#include <testMathExc.h>

#include <string.h>

Expand All @@ -18,5 +19,6 @@ int
main (int argc, char* argv[])
{
TEST (testBaseExc);
TEST (testMathExc);
return 0;
}
28 changes: 28 additions & 0 deletions src/test/IexTest/mathFuncs.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#undef __THROW
#include <math.h>
#include <iostream>

float
divide (float x, float y)
{
std::cout << x << " / " << y << std::endl;
return x / y;
}

float
root (float x)
{
std::cout << "sqrt (" << x << ")" << std::endl;
return sqrt (x);
}

float
grow (float x, int y)
{
std::cout << "grow (" << x << ", " << y << ")" << std::endl;

for (int i = 0; i < y; i++)
x = x * x;

return x;
}
5 changes: 5 additions & 0 deletions src/test/IexTest/mathFuncs.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@

float divide (float x, float y);
float root (float x);
float grow (float x, int y);

Loading

0 comments on commit 673205a

Please sign in to comment.