| 996 | } |
| 997 | |
| 998 | TEST(QPilotOSMachine, test) |
| 999 | { |
| 1000 | bool test_val = true; |
| 1001 | /*{ |
| 1002 | MPSQVM machine; |
| 1003 | machine.setConfigure({ 64,64 }); |
| 1004 | machine.init(); |
| 1005 | |
| 1006 | auto q = machine.qAllocMany(63); |
| 1007 | auto c = machine.cAllocMany(5); |
| 1008 | QProg prog; |
| 1009 | prog << H(q[0]) << RPhi(q[45], 0.3, 0.5) << Measure(q[45], c[0]); |
| 1010 | auto result2 = machine.runWithConfiguration(prog, 1000); |
| 1011 | cout << "ssssssssss" << endl; |
| 1012 | }*/ |
| 1013 | |
| 1014 | try |
| 1015 | { |
| 1016 | resolv_conf(); |
| 1017 | QPilotOSMachine pilot_qvm("Pilot"); |
| 1018 | /* init接口后两个参数为司南页面服务的账号和密码,示例中为测试账号,为方便任务管理建议使用个人账号 */ |
| 1019 | //pilot_qvm.init("https://10.9.12.17:10080", true, "9B89981FF7244B3D83C9CBF0A65E956C"); |
| 1020 | pilot_qvm.init(std::string("https://") + global_conf.m_server_ip + ":" + std::to_string(global_conf.m_server_port), global_conf.m_output, global_conf.m_token); |
| 1021 | |
| 1022 | std::map<std::string, std::function<bool(QPilotOSMachine &, const CaseConf &)>> name2func; |
| 1023 | name2func.emplace("full_amplitude_measure", test_full_amplitude_measure); |
| 1024 | name2func.emplace("full_amplitude_pmeasure", test_full_amplitude_pmeasure); |
| 1025 | name2func.emplace("partial_amplitude_pmeasure", test_partial_amplitude_pmeasure); |
| 1026 | name2func.emplace("single_amplitude_pmeasure", test_single_amplitude_pmeasure); |
| 1027 | name2func.emplace("noise_measure", test_noise_measure); |
| 1028 | name2func.emplace("real_chip_measure", test_real_chip_measure); |
| 1029 | name2func.emplace("real_chip_measure_vec", test_real_chip_measure_vec); |
| 1030 | name2func.emplace("real_chip_measure_async", test_real_chip_measure_async); |
| 1031 | name2func.emplace("real_chip_measure_async_vec", test_real_chip_measure_async_vec); |
| 1032 | name2func.emplace("noise_learning", test_noise_learning); |
| 1033 | name2func.emplace("noise_learning_async", test_noise_learning_async); |
| 1034 | name2func.emplace("em_compute", test_em_compute); |
| 1035 | name2func.emplace("em_compute_async", test_em_compute_async); |
| 1036 | name2func.emplace("real_chip_expectation", test_real_chip_expectation); |
| 1037 | name2func.emplace("real_chip_expectation_async", test_real_chip_expectation_async); |
| 1038 | name2func.emplace("get_state_fidelity", test_get_state_fidelity); |
| 1039 | name2func.emplace("test_parse", test_parse); |
| 1040 | |
| 1041 | for (auto& one_case : global_conf.m_cases) { |
| 1042 | if (name2func.find(one_case) == name2func.end()) { |
| 1043 | test_val = false; |
| 1044 | break; |
| 1045 | } |
| 1046 | test_val = name2func[one_case](pilot_qvm, global_conf.m_case_conf[one_case]); |
| 1047 | } |
| 1048 | #if 0 |
| 1049 | for (size_t i = 0; i < 1; ++i) |
| 1050 | { |
| 1051 | test_val = test_full_amplitude_measure(pilot_qvm); |
| 1052 | test_val = test_full_amplitude_pmeasure(pilot_qvm); |
| 1053 | test_val = test_partial_amplitude_pmeasure(pilot_qvm); |
| 1054 | test_val = test_single_amplitude_pmeasure(pilot_qvm); |
| 1055 | test_val = test_noise_measure(pilot_qvm); */ |
nothing calls this directly
no test coverage detected