@@ -54,10 +54,11 @@ namespace {
54
54
fs::path inner_unnamed_c = getTestFilePath(" inner_unnamed.c" );
55
55
fs::path array_sort_c = getTestFilePath(" array_sort.c" );
56
56
fs::path stubs_c = getTestFilePath(" stubs.c" );
57
- fs::path namespace_cpp = getTestFilePath(" namespace.cpp" );
58
57
fs::path input_output_c = getTestFilePath(" input_output.c" );
59
58
fs::path file_c = getTestFilePath(" file.c" );
60
59
fs::path bitfields_c = getTestFilePath(" bitfields.c" );
60
+ fs::path namespace_cpp = getTestFilePath(" namespace.cpp" );
61
+ fs::path rvalue_reference_cpp = getTestFilePath(" function_with_rvalue_params.cpp" );
61
62
62
63
void SetUp () override {
63
64
clearEnv (CompilationUtils::CompilerName::CLANG);
@@ -2779,7 +2780,7 @@ namespace {
2779
2780
);
2780
2781
}
2781
2782
2782
- TEST_F (Syntax_Test, multi_union ) {
2783
+ TEST_F (Syntax_Test, multi_union_cpp ) {
2783
2784
auto [testGen, status] = createTestForFunction (namespace_cpp, 38 );
2784
2785
2785
2786
ASSERT_TRUE (status.ok ()) << status.error_message ();
@@ -2798,6 +2799,146 @@ namespace {
2798
2799
);
2799
2800
}
2800
2801
2802
+ TEST_F (Syntax_Test, multiple_rvalue_params) {
2803
+ auto [testGen, status] = createTestForFunction (rvalue_reference_cpp, 9 );
2804
+
2805
+ ASSERT_TRUE (status.ok ()) << status.error_message ();
2806
+
2807
+ testUtils::checkMinNumberOfTests (testGen.tests .at (rvalue_reference_cpp).methods .begin ().value ().testCases , 2 );
2808
+
2809
+ checkTestCasePredicates (
2810
+ testGen.tests .at (rvalue_reference_cpp).methods .begin ().value ().testCases ,
2811
+ std::vector<TestCasePredicate>(
2812
+ {
2813
+ [] (const tests::Tests::MethodTestCase& testCase) {
2814
+ return stoi (testCase.paramValues [0 ].view ->getEntryValue (nullptr )) >
2815
+ stoi (testCase.paramValues [1 ].view ->getEntryValue (nullptr ));
2816
+ },
2817
+ [] (const tests::Tests::MethodTestCase& testCase) {
2818
+ return stoi (testCase.paramValues [0 ].view ->getEntryValue (nullptr )) <=
2819
+ stoi (testCase.paramValues [1 ].view ->getEntryValue (nullptr ));
2820
+ }
2821
+ })
2822
+ );
2823
+
2824
+ checkTestCasePredicates (
2825
+ testGen.tests .at (rvalue_reference_cpp).methods .begin ().value ().testCases ,
2826
+ std::vector<TestCasePredicate>(
2827
+ {
2828
+ [] (const tests::Tests::MethodTestCase& testCase) {
2829
+ return 2 * stoi (testCase.paramValues [0 ].view ->getEntryValue (nullptr )) ==
2830
+ stoi (testCase.returnValue .view ->getEntryValue (nullptr ));
2831
+ },
2832
+ [] (const tests::Tests::MethodTestCase& testCase) {
2833
+ return 2 * stoi (testCase.paramValues [1 ].view ->getEntryValue (nullptr )) ==
2834
+ stoi (testCase.returnValue .view ->getEntryValue (nullptr ));
2835
+ }
2836
+ })
2837
+ );
2838
+
2839
+ }
2840
+
2841
+ TEST_F (Syntax_Test, const_rvalue_reference) {
2842
+ auto [testGen, status] = createTestForFunction (rvalue_reference_cpp, 17 );
2843
+
2844
+ ASSERT_TRUE (status.ok ()) << status.error_message ();
2845
+
2846
+ testUtils::checkMinNumberOfTests (testGen.tests .at (rvalue_reference_cpp).methods .begin ().value ().testCases , 3 );
2847
+
2848
+ checkTestCasePredicates (
2849
+ testGen.tests .at (rvalue_reference_cpp).methods .begin ().value ().testCases ,
2850
+ std::vector<TestCasePredicate>(
2851
+ {
2852
+ [] (const tests::Tests::MethodTestCase& testCase) {
2853
+ return stoi (testCase.returnValue .view ->getEntryValue (nullptr )) == 0 ;
2854
+ },
2855
+ [] (const tests::Tests::MethodTestCase& testCase) {
2856
+ return stoi (testCase.returnValue .view ->getEntryValue (nullptr )) == 1 ;
2857
+ },
2858
+ [] (const tests::Tests::MethodTestCase& testCase) {
2859
+ return stoi (testCase.returnValue .view ->getEntryValue (nullptr )) == 2 ;
2860
+ }
2861
+ })
2862
+ );
2863
+
2864
+ checkTestCasePredicates (
2865
+ testGen.tests .at (rvalue_reference_cpp).methods .begin ().value ().testCases ,
2866
+ std::vector<TestCasePredicate>(
2867
+ {
2868
+ [] (const tests::Tests::MethodTestCase& testCase) {
2869
+ return stoi (testCase.paramValues .front ().view ->getEntryValue (nullptr )) % 3 == 0 ;
2870
+ },
2871
+ [] (const tests::Tests::MethodTestCase& testCase) {
2872
+ return stoi (testCase.paramValues .front ().view ->getEntryValue (nullptr )) % 3 == 1 ;
2873
+ },
2874
+ [] (const tests::Tests::MethodTestCase& testCase) {
2875
+ return stoi (testCase.paramValues .front ().view ->getEntryValue (nullptr )) % 3 == 2 ;
2876
+ }
2877
+ })
2878
+ );
2879
+ }
2880
+
2881
+ TEST_F (Syntax_Test, return_and_get_params) {
2882
+ auto [testGen, status] = createTestForFunction (rvalue_reference_cpp, 28 );
2883
+
2884
+ ASSERT_TRUE (status.ok ()) << status.error_message ();
2885
+
2886
+ testUtils::checkMinNumberOfTests (testGen.tests .at (rvalue_reference_cpp).methods .begin ().value ().testCases , 3 );
2887
+
2888
+ checkTestCasePredicates (
2889
+ testGen.tests .at (rvalue_reference_cpp).methods .begin ().value ().testCases ,
2890
+ std::vector<TestCasePredicate>(
2891
+ {
2892
+ [] (const tests::Tests::MethodTestCase& testCase) {
2893
+ return stoi (testCase.paramValues [0 ].view ->getEntryValue (nullptr )) % 5 == 0 ;
2894
+ },
2895
+ [] (const tests::Tests::MethodTestCase& testCase) {
2896
+ return stoi (testCase.paramValues [1 ].view ->getEntryValue (nullptr )) % 5 == 0 ;
2897
+ }
2898
+ })
2899
+ );
2900
+
2901
+ checkTestCasePredicates (
2902
+ testGen.tests .at (rvalue_reference_cpp).methods .begin ().value ().testCases ,
2903
+ std::vector<TestCasePredicate>(
2904
+ {
2905
+ [] (const tests::Tests::MethodTestCase& testCase) {
2906
+ return stoi (testCase.paramValues [0 ].view ->getEntryValue (nullptr )) ==
2907
+ stoi (testCase.returnValue .view ->getEntryValue (nullptr ));
2908
+ },
2909
+ [] (const tests::Tests::MethodTestCase& testCase) {
2910
+ return stoi (testCase.paramValues [1 ].view ->getEntryValue (nullptr )) ==
2911
+ stoi (testCase.returnValue .view ->getEntryValue (nullptr ));
2912
+ },
2913
+ [] (const tests::Tests::MethodTestCase& testCase) {
2914
+ return stoi (testCase.paramValues [0 ].view ->getEntryValue (nullptr )) + stoi (testCase.paramValues [1 ].view ->getEntryValue (nullptr ))==
2915
+ stoi (testCase.returnValue .view ->getEntryValue (nullptr ));
2916
+ }
2917
+ })
2918
+ );
2919
+ }
2920
+
2921
+ TEST_F (Syntax_Test, rvalue_struct_param) {
2922
+ auto [testGen, status] = createTestForFunction (rvalue_reference_cpp, 38 );
2923
+
2924
+ ASSERT_TRUE (status.ok ()) << status.error_message ();
2925
+
2926
+ testUtils::checkMinNumberOfTests (testGen.tests .at (rvalue_reference_cpp).methods .begin ().value ().testCases , 4 );
2927
+
2928
+ checkTestCasePredicates (
2929
+ testGen.tests .at (rvalue_reference_cpp).methods .begin ().value ().testCases ,
2930
+ std::vector<TestCasePredicate>(
2931
+ {
2932
+ [] (const tests::Tests::MethodTestCase& testCase) {
2933
+ return stoi (testCase.returnValue .view ->getEntryValue (nullptr )) == 1 ;
2934
+ },
2935
+ [] (const tests::Tests::MethodTestCase& testCase) {
2936
+ return stoi (testCase.returnValue .view ->getEntryValue (nullptr )) == 2 ;
2937
+ }
2938
+ })
2939
+ );
2940
+ }
2941
+
2801
2942
TEST_F (Syntax_Test, simple_getc) {
2802
2943
auto [testGen, status] = createTestForFunction (input_output_c, 4 );
2803
2944
0 commit comments