Commit eb9e71e9 authored by Mccaskey, Alex's avatar Mccaskey, Alex
Browse files

fixing bug in gatefunction evaluate


Signed-off-by: Mccaskey, Alex's avatarAlex McCaskey <mccaskeyaj@ornl.gov>
parent 7f3f4fb8
Pipeline #63300 passed with stages
in 10 minutes and 35 seconds
......@@ -257,7 +257,8 @@ auto splitParameter = [](InstructionParameter instParam) {
auto instParamStr = instParam.as<std::string>();
split = xacc::split(instParamStr, ' ');
for (auto s : split) {
if (!isNumber(s) && !s.empty()) {
xacc::trim(s);
if (!isNumber(s) && !s.empty() && s.find("pi") == std::string::npos) {
rawParam = s;
}
}
......
......@@ -22,7 +22,19 @@ const std::string expectedQasm = "H qreg1\n"
"CNOT qreg1,qreg2\n"
"CNOT qreg0,qreg1\n"
"H qreg0\n";
TEST(GateFunctionTester, checkComplexAngleExpression) {
GateFunction f("foo");
auto rx = std::make_shared<Rx>(std::vector<int>{0});
xacc::InstructionParameter p("-theta - pi/2");
rx->setParameter(0, p);
f.addInstruction(rx);
std::cout << f.toString() << "\n";
auto evaled = f({1.57});
std::cout << evaled->toString() << "\n";
}
TEST(GateFunctionTester, checkFunctionMethods) {
GateFunction f("foo");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment