Commit 26e11a98 authored by Nguyen, Thien Minh's avatar Nguyen, Thien Minh
Browse files

Add check to the Q# Bell test



Signed-off-by: default avatarThien Nguyen <nguyentm@ornl.gov>
parent c8447ad2
Loading
Loading
Loading
Loading
+6 −3
Original line number Diff line number Diff line
@@ -3,10 +3,10 @@

// Include the external QSharp function.
// With EntryPoint() annotation, there are 3 functions generated:
// QCOR__TestBell__body(): raw Q# callable
// QCOR__TestBell__body(): raw Q# callable (marked internal)
// QCOR__TestBell(): EntryPoint type (with result printing), no return
// QCOR__TestBell__Interop(): InteropFriendly function (type casting to C-type function)
qcor_include_qsharp(QCOR__TestBell, void, int64_t)
qcor_include_qsharp(QCOR__TestBell__Interop, int64_t, int64_t)

// Compile with:
// Include both the qsharp source and this driver file 
@@ -16,6 +16,9 @@ qcor_include_qsharp(QCOR__TestBell, void, int64_t)
// Run with:
// $ ./a.out
int main() {
  QCOR__TestBell(1024);
  auto one_count = QCOR__TestBell__Interop(1024);
  std::cout << "One count: " << one_count << "\n";
  // In the range of Bell experiment: 50-50
  qcor_expect(one_count > 400 && one_count < 700);
  return 0;
}
 No newline at end of file