diff --git a/src/QsCompiler/Compiler/Templates/CppInterop.cs b/src/QsCompiler/Compiler/Templates/CppInterop.cs index 4caa2242cb..57b427d8ec 100644 --- a/src/QsCompiler/Compiler/Templates/CppInterop.cs +++ b/src/QsCompiler/Compiler/Templates/CppInterop.cs @@ -30,7 +30,7 @@ public string CppType() DataType.RangeType => "InteropRange*", DataType.ResultType => "char", DataType.StringType => "const char*", - DataType.ArrayType => "InteropArray *", + DataType.ArrayType => "InteropArray*", _ => throw new NotSupportedException($"Unsupported argument type {this.Type}") }; } diff --git a/src/QsCompiler/Compiler/Templates/QirDriverCpp.cs b/src/QsCompiler/Compiler/Templates/QirDriverCpp.cs index 176fcef63a..8987912fd4 100644 --- a/src/QsCompiler/Compiler/Templates/QirDriverCpp.cs +++ b/src/QsCompiler/Compiler/Templates/QirDriverCpp.cs @@ -71,6 +71,7 @@ void TranslateVector(vector& sourceVector, vector& destinationVector, func { destinationVector.resize(sourceVector.size()); transform(sourceVector.begin(), sourceVector.end(), destinationVector.begin(), translationFunction); +} "); } if (entryPointOperation.ContainsArgumentType(DataType.RangeType) || entryPointOperation.ContainsArrayType(DataType.RangeType)) { @@ -170,8 +171,9 @@ unique_ptr CreateInteropRange(RangeTuple rangeTuple) if (arg.CppCliVariableInitialValue() != null) { WriteLine($" {arg.CliValueVariableName()} = {arg.CppCliVariableInitialValue()};"); } - WriteLine($" app.add_option(\"{arg.CliOptionString()}\", {arg.CliValueVariableName()}, \"{arg.CliDescription()}\")->required()"); + Write($" app.add_option(\"{arg.CliOptionString()}\", {arg.CliValueVariableName()}, \"{arg.CliDescription()}\")->required()"); if (arg.TransformerMapName() != null) { + WriteLine(""); Write($" ->transform(CLI::CheckedTransformer({arg.TransformerMapName()}, CLI::ignore_case))"); } WriteLine(";"); @@ -222,6 +224,7 @@ unique_ptr CreateInteropRange(RangeTuple rangeTuple) WriteLine($" {arg.CppCliValueType()} {arg.InteropVariableName()} = {arg.CliValueVariableName()};"); break; } + WriteLine(""); } this.Write(@" // Redirect the simulator output from std::cout if the --simulation-output option is present. ostream* simulatorOutputStream = &cout; @@ -244,6 +247,7 @@ unique_ptr CreateInteropRange(RangeTuple rangeTuple) Write($" {arg.InteropVariableName()}.c_str()"); break; case DataType.ArrayType: + case DataType.RangeType: Write($" {arg.InteropVariableName()}.get()"); break; default: diff --git a/src/QsCompiler/Compiler/Templates/QirDriverCpp.tt b/src/QsCompiler/Compiler/Templates/QirDriverCpp.tt index 2704c4c8a2..edfd4468d0 100644 --- a/src/QsCompiler/Compiler/Templates/QirDriverCpp.tt +++ b/src/QsCompiler/Compiler/Templates/QirDriverCpp.tt @@ -47,6 +47,7 @@ void TranslateVector(vector& sourceVector, vector& destinationVector, func { destinationVector.resize(sourceVector.size()); transform(sourceVector.begin(), sourceVector.end(), destinationVector.begin(), translationFunction); +} <# } #> <# if (entryPointOperation.ContainsArgumentType(DataType.RangeType) || entryPointOperation.ContainsArrayType(DataType.RangeType)) { #> @@ -167,8 +168,9 @@ int main(int argc, char* argv[]) if (arg.CppCliVariableInitialValue() != null) { WriteLine($" {arg.CliValueVariableName()} = {arg.CppCliVariableInitialValue()};"); } - WriteLine($" app.add_option(\"{arg.CliOptionString()}\", {arg.CliValueVariableName()}, \"{arg.CliDescription()}\")->required()"); + Write($" app.add_option(\"{arg.CliOptionString()}\", {arg.CliValueVariableName()}, \"{arg.CliDescription()}\")->required()"); if (arg.TransformerMapName() != null) { + WriteLine(""); Write($" ->transform(CLI::CheckedTransformer({arg.TransformerMapName()}, CLI::ignore_case))"); } WriteLine(";"); @@ -221,6 +223,7 @@ int main(int argc, char* argv[]) WriteLine($" {arg.CppCliValueType()} {arg.InteropVariableName()} = {arg.CliValueVariableName()};"); break; } + WriteLine(""); } #> // Redirect the simulator output from std::cout if the --simulation-output option is present. ostream* simulatorOutputStream = &cout; @@ -241,6 +244,7 @@ int main(int argc, char* argv[]) Write($" {arg.InteropVariableName()}.c_str()"); break; case DataType.ArrayType: + case DataType.RangeType: Write($" {arg.InteropVariableName()}.get()"); break; default: diff --git a/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseBoolArg.cpp b/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseBoolArg.cpp index 5ea6cc4407..56edc2ea4a 100644 --- a/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseBoolArg.cpp +++ b/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseBoolArg.cpp @@ -60,6 +60,7 @@ int main(int argc, char* argv[]) CLI11_PARSE(app, argc, argv); char BoolArgInteropValue = BoolArgCliValue; + // Redirect the simulator output from std::cout if the --simulation-output option is present. ostream* simulatorOutputStream = &cout; ofstream simulationOutputFileStream; diff --git a/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseBoolArgWithValues.cpp b/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseBoolArgWithValues.cpp index d747b4744e..f62cde2437 100644 --- a/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseBoolArgWithValues.cpp +++ b/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseBoolArgWithValues.cpp @@ -60,6 +60,7 @@ int main(int argc, char* argv[]) CLI11_PARSE(app, argc, argv); char BoolArgInteropValue = BoolArgCliValue; + // Redirect the simulator output from std::cout if the --simulation-output option is present. ostream* simulatorOutputStream = &cout; ofstream simulationOutputFileStream; diff --git a/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseBoolArrayArg.cpp b/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseBoolArrayArg.cpp index 6d09bc4410..5fb3c9fccb 100644 --- a/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseBoolArrayArg.cpp +++ b/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseBoolArrayArg.cpp @@ -44,10 +44,11 @@ void TranslateVector(vector& sourceVector, vector& destinationVector, func { destinationVector.resize(sourceVector.size()); transform(sourceVector.begin(), sourceVector.end(), destinationVector.begin(), translationFunction); +} // This is the function corresponding to the QIR entry-point. extern "C" void UseBoolArrayArg( // NOLINT - InteropArray * BoolArrayArgInteropValue + InteropArray* BoolArrayArgInteropValue ); @@ -84,6 +85,7 @@ int main(int argc, char* argv[]) // Translate values to its final form after parsing. // Create an interop array of values. unique_ptr BoolArrayArgInteropValue = CreateInteropArray(BoolArrayArgCliValue); + // Redirect the simulator output from std::cout if the --simulation-output option is present. ostream* simulatorOutputStream = &cout; ofstream simulationOutputFileStream; diff --git a/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseBoolArrayArgWithValues.cpp b/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseBoolArrayArgWithValues.cpp index 6c9d4879cc..bf7d49b63f 100644 --- a/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseBoolArrayArgWithValues.cpp +++ b/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseBoolArrayArgWithValues.cpp @@ -44,10 +44,11 @@ void TranslateVector(vector& sourceVector, vector& destinationVector, func { destinationVector.resize(sourceVector.size()); transform(sourceVector.begin(), sourceVector.end(), destinationVector.begin(), translationFunction); +} // This is the function corresponding to the QIR entry-point. extern "C" void UseBoolArrayArgWithValues( // NOLINT - InteropArray * BoolArrayArgInteropValue + InteropArray* BoolArrayArgInteropValue ); @@ -84,6 +85,7 @@ int main(int argc, char* argv[]) // Translate values to its final form after parsing. // Create an interop array of values. unique_ptr BoolArrayArgInteropValue = CreateInteropArray(BoolArrayArgCliValue); + // Redirect the simulator output from std::cout if the --simulation-output option is present. ostream* simulatorOutputStream = &cout; ofstream simulationOutputFileStream; diff --git a/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseDoubleArg.cpp b/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseDoubleArg.cpp index 7602eee7bd..af2bbb469b 100644 --- a/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseDoubleArg.cpp +++ b/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseDoubleArg.cpp @@ -45,13 +45,13 @@ int main(int argc, char* argv[]) double_t DoubleArgCliValue; DoubleArgCliValue = 0.0; - app.add_option("--DoubleArg", DoubleArgCliValue, "A double value for the DoubleArg argument")->required() -; + app.add_option("--DoubleArg", DoubleArgCliValue, "A double value for the DoubleArg argument")->required(); // With all the options added, parse arguments from the command line. CLI11_PARSE(app, argc, argv); double_t DoubleArgInteropValue = DoubleArgCliValue; + // Redirect the simulator output from std::cout if the --simulation-output option is present. ostream* simulatorOutputStream = &cout; ofstream simulationOutputFileStream; diff --git a/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseDoubleArgWithValues.cpp b/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseDoubleArgWithValues.cpp index 03a9b4ffac..de3249a5ea 100644 --- a/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseDoubleArgWithValues.cpp +++ b/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseDoubleArgWithValues.cpp @@ -45,13 +45,13 @@ int main(int argc, char* argv[]) double_t DoubleArgCliValue; DoubleArgCliValue = 0.0; - app.add_option("--DoubleArg", DoubleArgCliValue, "A double value for the DoubleArg argument")->required() -; + app.add_option("--DoubleArg", DoubleArgCliValue, "A double value for the DoubleArg argument")->required(); // With all the options added, parse arguments from the command line. CLI11_PARSE(app, argc, argv); double_t DoubleArgInteropValue = DoubleArgCliValue; + // Redirect the simulator output from std::cout if the --simulation-output option is present. ostream* simulatorOutputStream = &cout; ofstream simulationOutputFileStream; diff --git a/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseDoubleArrayArg.cpp b/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseDoubleArrayArg.cpp index 8b7f9d1da5..987e0f8fa4 100644 --- a/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseDoubleArrayArg.cpp +++ b/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseDoubleArrayArg.cpp @@ -44,10 +44,11 @@ void TranslateVector(vector& sourceVector, vector& destinationVector, func { destinationVector.resize(sourceVector.size()); transform(sourceVector.begin(), sourceVector.end(), destinationVector.begin(), translationFunction); +} // This is the function corresponding to the QIR entry-point. extern "C" void UseDoubleArrayArg( // NOLINT - InteropArray * DoubleArrayArgInteropValue + InteropArray* DoubleArrayArgInteropValue ); @@ -67,8 +68,7 @@ int main(int argc, char* argv[]) "File where the output produced during the simulation is written"); vector DoubleArrayArgCliValue; - app.add_option("--DoubleArrayArg", DoubleArrayArgCliValue, "A double array value for the DoubleArrayArg argument")->required() -; + app.add_option("--DoubleArrayArg", DoubleArrayArgCliValue, "A double array value for the DoubleArrayArg argument")->required(); // With all the options added, parse arguments from the command line. CLI11_PARSE(app, argc, argv); @@ -76,6 +76,7 @@ int main(int argc, char* argv[]) // Translate values to its final form after parsing. // Create an interop array of values. unique_ptr DoubleArrayArgInteropValue = CreateInteropArray(DoubleArrayArgCliValue); + // Redirect the simulator output from std::cout if the --simulation-output option is present. ostream* simulatorOutputStream = &cout; ofstream simulationOutputFileStream; diff --git a/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseDoubleArrayArgWithValues.cpp b/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseDoubleArrayArgWithValues.cpp index f28042f1ca..892a379d73 100644 --- a/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseDoubleArrayArgWithValues.cpp +++ b/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseDoubleArrayArgWithValues.cpp @@ -44,10 +44,11 @@ void TranslateVector(vector& sourceVector, vector& destinationVector, func { destinationVector.resize(sourceVector.size()); transform(sourceVector.begin(), sourceVector.end(), destinationVector.begin(), translationFunction); +} // This is the function corresponding to the QIR entry-point. extern "C" void UseDoubleArrayArgWithValues( // NOLINT - InteropArray * DoubleArrayArgInteropValue + InteropArray* DoubleArrayArgInteropValue ); @@ -67,8 +68,7 @@ int main(int argc, char* argv[]) "File where the output produced during the simulation is written"); vector DoubleArrayArgCliValue; - app.add_option("--DoubleArrayArg", DoubleArrayArgCliValue, "A double array value for the DoubleArrayArg argument")->required() -; + app.add_option("--DoubleArrayArg", DoubleArrayArgCliValue, "A double array value for the DoubleArrayArg argument")->required(); // With all the options added, parse arguments from the command line. CLI11_PARSE(app, argc, argv); @@ -76,6 +76,7 @@ int main(int argc, char* argv[]) // Translate values to its final form after parsing. // Create an interop array of values. unique_ptr DoubleArrayArgInteropValue = CreateInteropArray(DoubleArrayArgCliValue); + // Redirect the simulator output from std::cout if the --simulation-output option is present. ostream* simulatorOutputStream = &cout; ofstream simulationOutputFileStream; diff --git a/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseIntegerArg.cpp b/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseIntegerArg.cpp index 71d948eebe..bded3a9fc5 100644 --- a/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseIntegerArg.cpp +++ b/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseIntegerArg.cpp @@ -45,13 +45,13 @@ int main(int argc, char* argv[]) int64_t IntegerArgCliValue; IntegerArgCliValue = 0; - app.add_option("--IntegerArg", IntegerArgCliValue, "A integer value for the IntegerArg argument")->required() -; + app.add_option("--IntegerArg", IntegerArgCliValue, "A integer value for the IntegerArg argument")->required(); // With all the options added, parse arguments from the command line. CLI11_PARSE(app, argc, argv); int64_t IntegerArgInteropValue = IntegerArgCliValue; + // Redirect the simulator output from std::cout if the --simulation-output option is present. ostream* simulatorOutputStream = &cout; ofstream simulationOutputFileStream; diff --git a/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseIntegerArgWithValues.cpp b/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseIntegerArgWithValues.cpp index 1e92592eea..cfec6a208a 100644 --- a/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseIntegerArgWithValues.cpp +++ b/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseIntegerArgWithValues.cpp @@ -45,13 +45,13 @@ int main(int argc, char* argv[]) int64_t IntegerArgCliValue; IntegerArgCliValue = 0; - app.add_option("--IntegerArg", IntegerArgCliValue, "A integer value for the IntegerArg argument")->required() -; + app.add_option("--IntegerArg", IntegerArgCliValue, "A integer value for the IntegerArg argument")->required(); // With all the options added, parse arguments from the command line. CLI11_PARSE(app, argc, argv); int64_t IntegerArgInteropValue = IntegerArgCliValue; + // Redirect the simulator output from std::cout if the --simulation-output option is present. ostream* simulatorOutputStream = &cout; ofstream simulationOutputFileStream; diff --git a/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseIntegerArrayArg.cpp b/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseIntegerArrayArg.cpp index f8c9ac6724..e0f847a330 100644 --- a/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseIntegerArrayArg.cpp +++ b/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseIntegerArrayArg.cpp @@ -44,10 +44,11 @@ void TranslateVector(vector& sourceVector, vector& destinationVector, func { destinationVector.resize(sourceVector.size()); transform(sourceVector.begin(), sourceVector.end(), destinationVector.begin(), translationFunction); +} // This is the function corresponding to the QIR entry-point. extern "C" void UseIntegerArrayArg( // NOLINT - InteropArray * IntegerArrayArgInteropValue + InteropArray* IntegerArrayArgInteropValue ); @@ -67,8 +68,7 @@ int main(int argc, char* argv[]) "File where the output produced during the simulation is written"); vector IntegerArrayArgCliValue; - app.add_option("--IntegerArrayArg", IntegerArrayArgCliValue, "A integer array value for the IntegerArrayArg argument")->required() -; + app.add_option("--IntegerArrayArg", IntegerArrayArgCliValue, "A integer array value for the IntegerArrayArg argument")->required(); // With all the options added, parse arguments from the command line. CLI11_PARSE(app, argc, argv); @@ -76,6 +76,7 @@ int main(int argc, char* argv[]) // Translate values to its final form after parsing. // Create an interop array of values. unique_ptr IntegerArrayArgInteropValue = CreateInteropArray(IntegerArrayArgCliValue); + // Redirect the simulator output from std::cout if the --simulation-output option is present. ostream* simulatorOutputStream = &cout; ofstream simulationOutputFileStream; diff --git a/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseIntegerArrayArgWithValues.cpp b/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseIntegerArrayArgWithValues.cpp index 1a486871be..41c5c80822 100644 --- a/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseIntegerArrayArgWithValues.cpp +++ b/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseIntegerArrayArgWithValues.cpp @@ -44,10 +44,11 @@ void TranslateVector(vector& sourceVector, vector& destinationVector, func { destinationVector.resize(sourceVector.size()); transform(sourceVector.begin(), sourceVector.end(), destinationVector.begin(), translationFunction); +} // This is the function corresponding to the QIR entry-point. extern "C" void UseIntegerArrayArgWithValues( // NOLINT - InteropArray * IntegerArrayArgInteropValue + InteropArray* IntegerArrayArgInteropValue ); @@ -67,8 +68,7 @@ int main(int argc, char* argv[]) "File where the output produced during the simulation is written"); vector IntegerArrayArgCliValue; - app.add_option("--IntegerArrayArg", IntegerArrayArgCliValue, "A integer array value for the IntegerArrayArg argument")->required() -; + app.add_option("--IntegerArrayArg", IntegerArrayArgCliValue, "A integer array value for the IntegerArrayArg argument")->required(); // With all the options added, parse arguments from the command line. CLI11_PARSE(app, argc, argv); @@ -76,6 +76,7 @@ int main(int argc, char* argv[]) // Translate values to its final form after parsing. // Create an interop array of values. unique_ptr IntegerArrayArgInteropValue = CreateInteropArray(IntegerArrayArgCliValue); + // Redirect the simulator output from std::cout if the --simulation-output option is present. ostream* simulatorOutputStream = &cout; ofstream simulationOutputFileStream; diff --git a/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseMiscArgs.cpp b/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseMiscArgs.cpp index 54d6ff372c..01844bd2df 100644 --- a/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseMiscArgs.cpp +++ b/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseMiscArgs.cpp @@ -44,12 +44,13 @@ void TranslateVector(vector& sourceVector, vector& destinationVector, func { destinationVector.resize(sourceVector.size()); transform(sourceVector.begin(), sourceVector.end(), destinationVector.begin(), translationFunction); +} // This is the function corresponding to the QIR entry-point. extern "C" void UseMiscArgs( // NOLINT char IntegerArgInteropValue, char PauliArgInteropValue, - InteropArray * ResultArrayArgInteropValue + InteropArray* ResultArrayArgInteropValue ); @@ -115,11 +116,14 @@ int main(int argc, char* argv[]) CLI11_PARSE(app, argc, argv); char IntegerArgInteropValue = IntegerArgCliValue; + // Translate a PauliID value to its char representation. char PauliArgInteropValue = TranslatePauliToChar(PauliArgCliValue); + // Translate values to its final form after parsing. // Create an interop array of values. unique_ptr ResultArrayArgInteropValue = CreateInteropArray(ResultArrayArgCliValue); + // Redirect the simulator output from std::cout if the --simulation-output option is present. ostream* simulatorOutputStream = &cout; ofstream simulationOutputFileStream; diff --git a/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UsePauliArg.cpp b/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UsePauliArg.cpp index c50d98f056..978a164b7f 100644 --- a/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UsePauliArg.cpp +++ b/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UsePauliArg.cpp @@ -65,6 +65,7 @@ int main(int argc, char* argv[]) // Translate a PauliID value to its char representation. char PauliArgInteropValue = TranslatePauliToChar(PauliArgCliValue); + // Redirect the simulator output from std::cout if the --simulation-output option is present. ostream* simulatorOutputStream = &cout; ofstream simulationOutputFileStream; diff --git a/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UsePauliArgWithValues.cpp b/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UsePauliArgWithValues.cpp index 298959cef8..4b7aa9f256 100644 --- a/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UsePauliArgWithValues.cpp +++ b/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UsePauliArgWithValues.cpp @@ -65,6 +65,7 @@ int main(int argc, char* argv[]) // Translate a PauliID value to its char representation. char PauliArgInteropValue = TranslatePauliToChar(PauliArgCliValue); + // Redirect the simulator output from std::cout if the --simulation-output option is present. ostream* simulatorOutputStream = &cout; ofstream simulationOutputFileStream; diff --git a/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UsePauliArrayArg.cpp b/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UsePauliArrayArg.cpp index 109e311fd6..2c7f05c128 100644 --- a/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UsePauliArrayArg.cpp +++ b/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UsePauliArrayArg.cpp @@ -44,10 +44,11 @@ void TranslateVector(vector& sourceVector, vector& destinationVector, func { destinationVector.resize(sourceVector.size()); transform(sourceVector.begin(), sourceVector.end(), destinationVector.begin(), translationFunction); +} // This is the function corresponding to the QIR entry-point. extern "C" void UsePauliArrayArg( // NOLINT - InteropArray * PauliArrayArgInteropValue + InteropArray* PauliArrayArgInteropValue ); @@ -89,6 +90,7 @@ int main(int argc, char* argv[]) vector PauliArrayArgIntermediateValue; TranslateVector(PauliArrayArgCliValue, PauliArrayArgIntermediateValue, TranslatePauliToChar); unique_ptr PauliArrayArgInteropValue = CreateInteropArray(PauliArrayArgIntermediateValue); + // Redirect the simulator output from std::cout if the --simulation-output option is present. ostream* simulatorOutputStream = &cout; ofstream simulationOutputFileStream; diff --git a/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UsePauliArrayArgWithValues.cpp b/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UsePauliArrayArgWithValues.cpp index ece502508e..e03a11beb5 100644 --- a/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UsePauliArrayArgWithValues.cpp +++ b/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UsePauliArrayArgWithValues.cpp @@ -44,10 +44,11 @@ void TranslateVector(vector& sourceVector, vector& destinationVector, func { destinationVector.resize(sourceVector.size()); transform(sourceVector.begin(), sourceVector.end(), destinationVector.begin(), translationFunction); +} // This is the function corresponding to the QIR entry-point. extern "C" void UsePauliArrayArgWithValues( // NOLINT - InteropArray * PauliArrayArgInteropValue + InteropArray* PauliArrayArgInteropValue ); @@ -89,6 +90,7 @@ int main(int argc, char* argv[]) vector PauliArrayArgIntermediateValue; TranslateVector(PauliArrayArgCliValue, PauliArrayArgIntermediateValue, TranslatePauliToChar); unique_ptr PauliArrayArgInteropValue = CreateInteropArray(PauliArrayArgIntermediateValue); + // Redirect the simulator output from std::cout if the --simulation-output option is present. ostream* simulatorOutputStream = &cout; ofstream simulationOutputFileStream; diff --git a/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseRangeArg.cpp b/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseRangeArg.cpp index a003b57446..f078f2dca2 100644 --- a/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseRangeArg.cpp +++ b/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseRangeArg.cpp @@ -74,14 +74,14 @@ int main(int argc, char* argv[]) "File where the output produced during the simulation is written"); RangeTuple RangeArgCliValue; - app.add_option("--RangeArg", RangeArgCliValue, "A Range (start, step, end) value for the RangeArg argument")->required() -; + app.add_option("--RangeArg", RangeArgCliValue, "A Range (start, step, end) value for the RangeArg argument")->required(); // With all the options added, parse arguments from the command line. CLI11_PARSE(app, argc, argv); // Create an interop range. unique_ptr RangeArgInteropValue = CreateInteropRange(RangeArgCliValue); + // Redirect the simulator output from std::cout if the --simulation-output option is present. ostream* simulatorOutputStream = &cout; ofstream simulationOutputFileStream; @@ -94,7 +94,7 @@ int main(int argc, char* argv[]) // Run simulation and write the output of the operation to the corresponding stream. UseRangeArg( - RangeArgInteropValue + RangeArgInteropValue.get() ); diff --git a/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseRangeArgWithValues.cpp b/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseRangeArgWithValues.cpp index 07382702e5..0481d1ab14 100644 --- a/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseRangeArgWithValues.cpp +++ b/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseRangeArgWithValues.cpp @@ -74,14 +74,14 @@ int main(int argc, char* argv[]) "File where the output produced during the simulation is written"); RangeTuple RangeArgCliValue; - app.add_option("--RangeArg", RangeArgCliValue, "A Range (start, step, end) value for the RangeArg argument")->required() -; + app.add_option("--RangeArg", RangeArgCliValue, "A Range (start, step, end) value for the RangeArg argument")->required(); // With all the options added, parse arguments from the command line. CLI11_PARSE(app, argc, argv); // Create an interop range. unique_ptr RangeArgInteropValue = CreateInteropRange(RangeArgCliValue); + // Redirect the simulator output from std::cout if the --simulation-output option is present. ostream* simulatorOutputStream = &cout; ofstream simulationOutputFileStream; @@ -94,7 +94,7 @@ int main(int argc, char* argv[]) // Run simulation and write the output of the operation to the corresponding stream. UseRangeArgWithValues( - RangeArgInteropValue + RangeArgInteropValue.get() ); diff --git a/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseRangeArrayArg.cpp b/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseRangeArrayArg.cpp index b037917453..6f7622f2cf 100644 --- a/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseRangeArrayArg.cpp +++ b/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseRangeArrayArg.cpp @@ -44,6 +44,7 @@ void TranslateVector(vector& sourceVector, vector& destinationVector, func { destinationVector.resize(sourceVector.size()); transform(sourceVector.begin(), sourceVector.end(), destinationVector.begin(), translationFunction); +} using RangeTuple = tuple; struct InteropRange @@ -86,7 +87,7 @@ void FreePointerVector(vector& v) // This is the function corresponding to the QIR entry-point. extern "C" void UseRangeArrayArg( // NOLINT - InteropArray * RangeArrayArgInteropValue + InteropArray* RangeArrayArgInteropValue ); @@ -106,8 +107,7 @@ int main(int argc, char* argv[]) "File where the output produced during the simulation is written"); vector RangeArrayArgCliValue; - app.add_option("--RangeArrayArg", RangeArrayArgCliValue, "A Range array value for the RangeArrayArg argument")->required() -; + app.add_option("--RangeArrayArg", RangeArrayArgCliValue, "A Range array value for the RangeArrayArg argument")->required(); // With all the options added, parse arguments from the command line. CLI11_PARSE(app, argc, argv); @@ -115,6 +115,7 @@ int main(int argc, char* argv[]) vector RangeArrayArgIntermediateValue; TranslateVector(RangeArrayArgCliValue, RangeArrayArgIntermediateValue, TranslateRangeTupleToInteropRangePointer); unique_ptr RangeArrayArgInteropValue = CreateInteropArray(RangeArrayArgIntermediateValue); + // Redirect the simulator output from std::cout if the --simulation-output option is present. ostream* simulatorOutputStream = &cout; ofstream simulationOutputFileStream; diff --git a/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseRangeArrayArgWithValues.cpp b/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseRangeArrayArgWithValues.cpp index d85f3e7748..fd94f3bad5 100644 --- a/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseRangeArrayArgWithValues.cpp +++ b/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseRangeArrayArgWithValues.cpp @@ -44,6 +44,7 @@ void TranslateVector(vector& sourceVector, vector& destinationVector, func { destinationVector.resize(sourceVector.size()); transform(sourceVector.begin(), sourceVector.end(), destinationVector.begin(), translationFunction); +} using RangeTuple = tuple; struct InteropRange @@ -86,7 +87,7 @@ void FreePointerVector(vector& v) // This is the function corresponding to the QIR entry-point. extern "C" void UseRangeArrayArgWithValues( // NOLINT - InteropArray * RangeArrayArgInteropValue + InteropArray* RangeArrayArgInteropValue ); @@ -106,8 +107,7 @@ int main(int argc, char* argv[]) "File where the output produced during the simulation is written"); vector RangeArrayArgCliValue; - app.add_option("--RangeArrayArg", RangeArrayArgCliValue, "A Range array value for the RangeArrayArg argument")->required() -; + app.add_option("--RangeArrayArg", RangeArrayArgCliValue, "A Range array value for the RangeArrayArg argument")->required(); // With all the options added, parse arguments from the command line. CLI11_PARSE(app, argc, argv); @@ -115,6 +115,7 @@ int main(int argc, char* argv[]) vector RangeArrayArgIntermediateValue; TranslateVector(RangeArrayArgCliValue, RangeArrayArgIntermediateValue, TranslateRangeTupleToInteropRangePointer); unique_ptr RangeArrayArgInteropValue = CreateInteropArray(RangeArrayArgIntermediateValue); + // Redirect the simulator output from std::cout if the --simulation-output option is present. ostream* simulatorOutputStream = &cout; ofstream simulationOutputFileStream; diff --git a/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseResultArg.cpp b/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseResultArg.cpp index 977bf6d415..90437295ce 100644 --- a/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseResultArg.cpp +++ b/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseResultArg.cpp @@ -61,6 +61,7 @@ int main(int argc, char* argv[]) CLI11_PARSE(app, argc, argv); char ResultArgInteropValue = ResultArgCliValue; + // Redirect the simulator output from std::cout if the --simulation-output option is present. ostream* simulatorOutputStream = &cout; ofstream simulationOutputFileStream; diff --git a/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseResultArgWithValues.cpp b/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseResultArgWithValues.cpp index c4509acff4..186dd217ad 100644 --- a/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseResultArgWithValues.cpp +++ b/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseResultArgWithValues.cpp @@ -61,6 +61,7 @@ int main(int argc, char* argv[]) CLI11_PARSE(app, argc, argv); char ResultArgInteropValue = ResultArgCliValue; + // Redirect the simulator output from std::cout if the --simulation-output option is present. ostream* simulatorOutputStream = &cout; ofstream simulationOutputFileStream; diff --git a/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseResultArrayArg.cpp b/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseResultArrayArg.cpp index 1e3d364e90..1a13c0c276 100644 --- a/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseResultArrayArg.cpp +++ b/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseResultArrayArg.cpp @@ -44,10 +44,11 @@ void TranslateVector(vector& sourceVector, vector& destinationVector, func { destinationVector.resize(sourceVector.size()); transform(sourceVector.begin(), sourceVector.end(), destinationVector.begin(), translationFunction); +} // This is the function corresponding to the QIR entry-point. extern "C" void UseResultArrayArg( // NOLINT - InteropArray * ResultArrayArgInteropValue + InteropArray* ResultArrayArgInteropValue ); @@ -85,6 +86,7 @@ int main(int argc, char* argv[]) // Translate values to its final form after parsing. // Create an interop array of values. unique_ptr ResultArrayArgInteropValue = CreateInteropArray(ResultArrayArgCliValue); + // Redirect the simulator output from std::cout if the --simulation-output option is present. ostream* simulatorOutputStream = &cout; ofstream simulationOutputFileStream; diff --git a/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseResultArrayArgWithValues.cpp b/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseResultArrayArgWithValues.cpp index 4ad81dbb32..eb10cb2c3b 100644 --- a/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseResultArrayArgWithValues.cpp +++ b/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseResultArrayArgWithValues.cpp @@ -44,10 +44,11 @@ void TranslateVector(vector& sourceVector, vector& destinationVector, func { destinationVector.resize(sourceVector.size()); transform(sourceVector.begin(), sourceVector.end(), destinationVector.begin(), translationFunction); +} // This is the function corresponding to the QIR entry-point. extern "C" void UseResultArrayArgWithValues( // NOLINT - InteropArray * ResultArrayArgInteropValue + InteropArray* ResultArrayArgInteropValue ); @@ -85,6 +86,7 @@ int main(int argc, char* argv[]) // Translate values to its final form after parsing. // Create an interop array of values. unique_ptr ResultArrayArgInteropValue = CreateInteropArray(ResultArrayArgCliValue); + // Redirect the simulator output from std::cout if the --simulation-output option is present. ostream* simulatorOutputStream = &cout; ofstream simulationOutputFileStream; diff --git a/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseStringArg.cpp b/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseStringArg.cpp index 1a640bd777..11106fca8d 100644 --- a/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseStringArg.cpp +++ b/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseStringArg.cpp @@ -49,13 +49,13 @@ int main(int argc, char* argv[]) "File where the output produced during the simulation is written"); string StringArgCliValue; - app.add_option("--StringArg", StringArgCliValue, "A String value for the StringArg argument")->required() -; + app.add_option("--StringArg", StringArgCliValue, "A String value for the StringArg argument")->required(); // With all the options added, parse arguments from the command line. CLI11_PARSE(app, argc, argv); string StringArgInteropValue = StringArgCliValue; + // Redirect the simulator output from std::cout if the --simulation-output option is present. ostream* simulatorOutputStream = &cout; ofstream simulationOutputFileStream; diff --git a/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseStringArgWithValues.cpp b/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseStringArgWithValues.cpp index bb96cdb95b..6dae3fe59b 100644 --- a/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseStringArgWithValues.cpp +++ b/src/QsCompiler/Tests.Compiler/TestCases/QirEntryPointTests/UseStringArgWithValues.cpp @@ -49,13 +49,13 @@ int main(int argc, char* argv[]) "File where the output produced during the simulation is written"); string StringArgCliValue; - app.add_option("--StringArg", StringArgCliValue, "A String value for the StringArg argument")->required() -; + app.add_option("--StringArg", StringArgCliValue, "A String value for the StringArg argument")->required(); // With all the options added, parse arguments from the command line. CLI11_PARSE(app, argc, argv); string StringArgInteropValue = StringArgCliValue; + // Redirect the simulator output from std::cout if the --simulation-output option is present. ostream* simulatorOutputStream = &cout; ofstream simulationOutputFileStream;