-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[series] add complex type, drop gmpxx dependency
- Loading branch information
Showing
17 changed files
with
439 additions
and
130 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
include ./Makefile.conf | ||
include ../test_suite/Makefile.conf | ||
|
||
.PHONY : compile | ||
compile : $(TEST_NAME) | ||
|
||
.PHONY : test | ||
test : test.log | ||
test.log : $(TEST_NAME) | ||
./$< 2>&1 >test.log \ | ||
&& printf "\n@@@ SUCCESS @@@" >> test.log || printf "\n@@@ FAILURE @@@" >> test.log | ||
|
||
ifneq ($(CXX), nvcc) | ||
|
||
.PHONY : coverage | ||
coverage : coverage.html | ||
|
||
coverage.log : $(TEST_NAME) test.log | ||
$(GCOV) $(GCOVFLAGS) $< 2>&1 >coverage.log | ||
|
||
coverage.html : %.html : %.log | ||
$(GCOVR) $(GCOVRFLAGS) -o $@ | ||
|
||
endif | ||
|
||
.PHONY : clean | ||
clean : | ||
rm -rf coverage.log test.log *.o *.gcov *.dSYM *.gcda *.gcno *.html $(TEST_NAME) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
TEST_NAME = test_exparse_mpqc |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
#include "catch.hpp" | ||
#include "exparse.hpp" | ||
|
||
TEST_CASE( "Operations" , "[mpqc]" ) | ||
{ | ||
mpqc_class one_char("1"); | ||
mpqc_class hq_char("1/2","1/4"); | ||
mpqc_class a_mpq("2","3"); | ||
mpqc_class b_mpq("4","5"); | ||
mpqc_class a_char("2","3"); | ||
mpqc_class c_double(123.,456.); | ||
|
||
SECTION( "Comparator Operators" ) | ||
{ | ||
REQUIRE( a_char == mpqc_class("2","3") ); | ||
REQUIRE( a_char != mpqc_class("4","5") ); | ||
}; | ||
|
||
SECTION( "Constructors" ) | ||
{ | ||
REQUIRE( mpqc_class() == mpqc_class("0","0") ); // no args => (0,0) | ||
REQUIRE( one_char == mpqc_class("1","0") ); | ||
REQUIRE( hq_char == mpqc_class("1/2","1/4") ); | ||
REQUIRE( mpq_get_d(c_double.re) == Approx(123.)); | ||
REQUIRE( mpq_get_d(c_double.im) == Approx(456.)); | ||
}; | ||
|
||
SECTION( "Unary Operators" ) | ||
{ | ||
REQUIRE( -a_mpq == mpqc_class("-2","-3") ); | ||
REQUIRE( +a_mpq == mpqc_class("2","3") ); | ||
}; | ||
|
||
SECTION( "Assignment Operators [+]" ) | ||
{ | ||
a_mpq += b_mpq; | ||
REQUIRE( a_mpq == mpqc_class("6","8") ); | ||
}; | ||
|
||
SECTION( "Assignment Operators [-]" ) | ||
{ | ||
a_mpq -= b_mpq; | ||
REQUIRE( a_mpq == mpqc_class("-2","-2") ); | ||
}; | ||
|
||
SECTION( "Assignment Operators [*]" ) | ||
{ | ||
a_mpq *= b_mpq; | ||
REQUIRE( a_mpq == mpqc_class("-7","22") ); | ||
}; | ||
|
||
SECTION( "Assignment Operators [/]" ) | ||
{ | ||
a_mpq /= b_mpq; | ||
REQUIRE( a_mpq == mpqc_class("23/41","2/41") ); | ||
}; | ||
|
||
SECTION( "Binary Operators (2)" ) | ||
{ | ||
REQUIRE( a_mpq + b_mpq == mpqc_class("6","8") ); | ||
REQUIRE( a_mpq - b_mpq == mpqc_class("-2","-2") ); | ||
REQUIRE( a_mpq * b_mpq == mpqc_class("-7","22") ); | ||
REQUIRE( a_mpq / b_mpq == mpqc_class("23/41","2/41") ); | ||
}; | ||
}; |
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.