Skip to content
This repository has been archived by the owner on Jan 12, 2024. It is now read-only.

Commit

Permalink
Restructured the files.
Browse files Browse the repository at this point in the history
  • Loading branch information
kuzminrobin committed Feb 5, 2021
1 parent 173925e commit 0cf4a5e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
3 changes: 2 additions & 1 deletion src/QirRuntime/test/QIR-static/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ add_custom_target(qir_static_test_lib DEPENDS ${QIR_TESTS_LIBS})
# The executable target for QIR tests triggers the custom actions to compile ll files
#
add_executable(qir-static-tests
qir-driver.cpp)
qir-driver.cpp
qir-test-math.cpp)

target_link_libraries(qir-static-tests PUBLIC
${QIR_TESTS_LIBS}
Expand Down
17 changes: 0 additions & 17 deletions src/QirRuntime/test/QIR-static/qir-driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <memory>
#include <string>
#include <unordered_set>
#include <cmath>

#include "CoreTypes.hpp"
#include "QuantumApi_I.hpp"
Expand Down Expand Up @@ -320,19 +319,3 @@ TEST_CASE("QIR: application of nested controlled functor", "[qir]")

g_ctrqapi = nullptr;
}




extern "C" double __quantum__qis__sqrt__body(double); // NOLINT

TEST_CASE("QIR: math", "[qir.math][qir.math.sqrt]")
{
REQUIRE(2.0 == __quantum__qis__sqrt__body((double)4.0));
REQUIRE(3.0 == __quantum__qis__sqrt__body((double)9.0));
REQUIRE(10.0 == __quantum__qis__sqrt__body((double)100.0));

REQUIRE( isnan(__quantum__qis__sqrt__body((double)-5.0)) ); // (double)NAN == sqrt((double)-5.0)
REQUIRE( isnan(__quantum__qis__sqrt__body(nan(""))) ); // (double)NAN == sqrt((double)<quiet NAN>)
REQUIRE( isinf(__quantum__qis__sqrt__body((double)INFINITY)) ); // +-infinity == sqrt((double) +infinity)
}
16 changes: 16 additions & 0 deletions src/QirRuntime/test/QIR-static/qir-test-math.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include <cmath>

#include "catch.hpp"

extern "C" double __quantum__qis__sqrt__body(double); // NOLINT

TEST_CASE("QIR: math.sqrt", "[qir.math][qir.math.sqrt]")
{
REQUIRE(2.0 == __quantum__qis__sqrt__body((double)4.0));
REQUIRE(3.0 == __quantum__qis__sqrt__body((double)9.0));
REQUIRE(10.0 == __quantum__qis__sqrt__body((double)100.0));

REQUIRE( isnan(__quantum__qis__sqrt__body((double)-5.0)) ); // (double)NAN == sqrt((double)-5.0)
REQUIRE( isnan(__quantum__qis__sqrt__body(nan(""))) ); // (double)NAN == sqrt((double)<quiet NAN>)
REQUIRE( isinf(__quantum__qis__sqrt__body((double)INFINITY)) ); // +-infinity == sqrt((double) +infinity)
}

1 comment on commit 0cf4a5e

@timothywsage
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am very interested, in this . I am very new to Quantum, but thought it would be great to send an encrypted message via a quantum array.
I was just looking for examples, and grabbed a raw copy. will gladly return if necessary. Amazing work !!!

Please sign in to comment.