Skip to content

Commit c6f184c

Browse files
committed
Added regression test .cpp compilation + execution results capture for MSVC 2022
And added some more counts to `run-tests.bat`
1 parent 55cc8c3 commit c6f184c

File tree

85 files changed

+259
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+259
-2
lines changed

regression-tests/pure2-look-up-parameter-across-unnamed-function.cpp2

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,7 @@ g: () -> (ri : int) = {
1111
ri = 42;
1212
return;
1313
}
14+
15+
main: ()->int = {
16+
std::cout << f().ri + g().ri << "\n";
17+
}

regression-tests/run-tests.bat

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ REM This is intended to be run in the /test-results directory
22
REM A copy is in the parent directory just for convenience in case of accidental deletion.
33
REM
44
@echo off
5+
del *.cpp *.output
56
copy ..\*.cpp2 .
67
set count=0
78
for %%f in (mixed-*.cpp2) do (
@@ -16,4 +17,17 @@ for %%f in (pure2-*.cpp2) do (
1617
del %%f
1718
set /a count+=1
1819
)
19-
echo Done: %count% tests
20+
set cpp_count=0
21+
for %%A in (*.cpp) do set /a cpp_count+=1
22+
set err_count=0
23+
for %%A in (..\*error.cpp2) do set /a err_count+=1
24+
set /a "total_count=%cpp_count%+%err_count%"
25+
echo.
26+
echo Done: %count% .cpp2 tests compiled
27+
echo.
28+
echo. %cpp_count% .cpp files generated
29+
echo. %err_count% error test cases (should not generate .cpp)
30+
echo. %total_count% total
31+
if %total_count% NEQ %count% (
32+
echo. *** MISMATCH: should equal total tests run
33+
)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Microsoft (R) C/C++ Optimizing Compiler Version 19.34.31933 for x86
2+
Copyright (C) Microsoft Corporation. All rights reserved.
3+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Hello world
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
mixed-allcpp1-hello.cpp
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
4456566
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
mixed-bounds-check.cpp
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
1
2+
44
3+
45
4+
46
5+
5
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
mixed-bounds-safety-with-assert-2.cpp
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Bounds safety violation
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
mixed-bounds-safety-with-assert.cpp
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
hello
2+
2022
3+
hello-ish
4+
2022-ish
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
mixed-captures-in-expressions-and-postconditions.cpp
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
hello-ish maybe
2+
2022-ish maybe
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
mixed-function-expression-and-std-for-each.cpp
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
hello
2+
2022
3+
hello-ish
4+
2022-ish
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
mixed-function-expression-and-std-ranges-for-each-with-capture.cpp
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
hello
2+
2022
3+
hello-ish
4+
2022-ish
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
mixed-function-expression-and-std-ranges-for-each.cpp
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
hello
3+
4+
2023
5+
hello-ish
6+
2023-ish
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
mixed-function-expression-with-pointer-capture.cpp
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
hello
3+
4+
2022
5+
hello-ish
6+
2022-ish
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
mixed-function-expression-with-repeated-capture.cpp
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Hello [world]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
mixed-hello.cpp
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Contract violation: fill: value must contain at least count elements
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
mixed-initialization-safety-3.cpp

regression-tests/test-results/msvc-2022/mixed-inspect-with-typeof-of-template-arg-list.cpp.execution

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
mixed-inspect-with-typeof-of-template-arg-list.cpp
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
>> hello
2+
>> big
3+
>> world
4+
** ** **
5+
>> [hello]
6+
>> [big]
7+
>> [world]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
mixed-intro-example-three-loops.cpp
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
1 42
2+
2 84
3+
3 168
4+
4 336
5+
5 672
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
mixed-intro-for-with-counter-include-last.cpp

regression-tests/test-results/msvc-2022/mixed-lifetime-safety-and-null-contracts.cpp.execution

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
mixed-lifetime-safety-and-null-contracts.cpp
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
>> 43
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
mixed-lifetime-safety-pointer-init-4.cpp
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
a is 10
2+
b is xyzzy
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
mixed-multiple-return-values.cpp

regression-tests/test-results/msvc-2022/mixed-parameter-passing-with-forward.cpp.execution

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
mixed-parameter-passing-with-forward.cpp

regression-tests/test-results/msvc-2022/mixed-parameter-passing.cpp.execution

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
mixed-parameter-passing.cpp

regression-tests/test-results/msvc-2022/mixed-postexpression-with-capture.cpp.execution

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
mixed-postexpression-with-capture.cpp

regression-tests/test-results/msvc-2022/mixed-postfix-expression-custom-formatting.cpp.execution

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
mixed-postfix-expression-custom-formatting.cpp
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
a = 2, b = (empty)
2+
a^2 + b = 46
3+
sv = my string_view
4+
osv = (empty)
5+
osv = string literal bound to optional string_view
6+
var = (empty)
7+
var = abracadabra
8+
var = 2.718280
9+
mypair = (12, 3.400000)
10+
tup1 = (12)
11+
tup2 = (12, 3.400000)
12+
tup3 = (12, 3.400000, 456)
13+
p = (first, (empty))
14+
t = (3.140000, (empty), (empty))
15+
vv = 0
16+
vv = (1, 2.300000)
17+
custom = (customize me - no cpp2::to_string overload exists for this type)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
mixed-string-interpolation.cpp
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
12
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
mixed-test-parens.cpp
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
1.1 is int? false
2+
1 is int? true
3+
4+
s* is Shape? true
5+
s* is Circle? true
6+
s* is Square? false
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
mixed-type-safety-1.cpp
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
>> decorated
2+
>> hello
3+
>> world
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pure2-bounds-safety-span.cpp

regression-tests/test-results/msvc-2022/pure2-bugfix-for-name-lookup-and-value-decoration.cpp.execution

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pure2-bugfix-for-name-lookup-and-value-decoration.cpp
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Hello [world]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pure2-hello.cpp
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
double value is not an int or string
2+
class std::variant<int,double> value is not an int or string
3+
class std::any value is "xyzzy"
4+
class std::optional<int> value is not an int or string
5+
int value is integer 42
6+
class std::variant<int,double> value is integer 1
7+
class std::any value is integer 2
8+
class std::optional<int> value is integer 3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
pure2-inspect-expression-in-generic-function-multiple-types.cpp
2+
Creating library test.lib and object test.exp
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
char const [7] value is not an int
2+
int value is 1
3+
double value is not an int
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pure2-inspect-expression-with-as-in-generic-function.cpp
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
2+
All these cases satisfy "matches std::string"
3+
4+
class std::variant<int,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >
5+
... matches std::string
6+
7+
class std::any
8+
... matches std::string
9+
10+
class std::optional<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >
11+
... matches std::string
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
pure2-inspect-fallback-with-variant-any-optional.cpp
2+
Creating library test.lib and object test.exp
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
All these cases satisfy "VOYDE AND EMPTIE"
3+
4+
class std::unique_ptr<int,struct std::default_delete<int> >
5+
... VOYDE AND EMPTIE
6+
7+
class std::_Vector_iterator<class std::_Vector_val<struct std::_Simple_types<int> > >
8+
... VOYDE AND EMPTIE
9+
10+
class std::variant<struct std::monostate,int,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >
11+
... VOYDE AND EMPTIE
12+
13+
class std::any
14+
... VOYDE AND EMPTIE
15+
16+
class std::optional<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >
17+
... VOYDE AND EMPTIE
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
pure2-inspect-generic-void-empty-with-variant-any-optional.cpp
2+
Creating library test.lib and object test.exp
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
>> [hello] - length 7
2+
>> [2022] - length 6
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pure2-intro-example-hello-2022.cpp
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
>> hello
2+
>> big
3+
>> world
4+
** ** **
5+
>> [hello]
6+
>> [big]
7+
>> [world]
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pure2-intro-example-three-loops.cpp
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
84
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pure2-look-up-parameter-across-unnamed-function.cpp

regression-tests/test-results/msvc-2022/pure2-stdio-with-raii.cpp.execution

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pure2-stdio-with-raii.cpp

regression-tests/test-results/msvc-2022/pure2-stdio.cpp.execution

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pure2-stdio.cpp
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
double is int? false
2+
class std::variant<int,double> is int? false
3+
class std::any is int? false
4+
class std::optional<int> is int? false
5+
6+
int is int? true
7+
class std::variant<int,double> is int? true
8+
class std::any is int? true
9+
class std::optional<int> is int? true
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
pure2-type-safety-1.cpp
2+
Creating library test.lib and object test.exp
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
double value is not an int
2+
class std::variant<int,double> value is not an int
3+
class std::any value is not an int
4+
class std::optional<int> value is not an int
5+
int value is 42
6+
class std::variant<int,double> value is 1
7+
class std::any value is 2
8+
class std::optional<int> value is 3
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
pure2-type-safety-2-with-inspect-expression.cpp
2+
Creating library test.lib and object test.exp
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
REM This is intended to be run in the /test-results/msvc-2022 directory
2+
REM in a VS2022 Command Prompt (which sets the path and other environment)
3+
REM
4+
@echo off
5+
copy ..\*.cpp .
6+
del *.output
7+
set count=0
8+
set exe_count=0
9+
cl 1>NUL 2> MSVC-version.output
10+
for %%f in (*.cpp) do (
11+
echo Starting MSVC cl.exe %%f
12+
cl.exe %%f -Fe"test" -nologo -std:c++latest -MD -EHsc -I c:\github\cppfront\include -experimental:module >> %%f.output 2>&1
13+
del %%f
14+
set /a count+=1
15+
IF EXIST "test.exe" (
16+
set /a exe_count+=1
17+
echo. Starting executable
18+
test.exe > %%f.execution 2>&1
19+
del test.exe
20+
)
21+
)
22+
del *.obj *.exp *.lib
23+
echo.
24+
echo Done: %count% .cpp tests compiled
25+
echo.
26+
echo. %exe_count% executables generated and run
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Hello Fred with UFCS!

regression-tests/test-results/pure2-look-up-parameter-across-unnamed-function.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ struct g__ret {
1515
};
1616
#line 9 "pure2-look-up-parameter-across-unnamed-function.cpp2"
1717
[[nodiscard]] auto g() -> g__ret;
18+
#line 15 "pure2-look-up-parameter-across-unnamed-function.cpp2"
19+
[[nodiscard]] auto main() -> int;
1820

1921
//=== Cpp2 definitions ==========================================================
2022

@@ -36,3 +38,7 @@ struct g__ret {
3638
ri.value() = 42;
3739
return { std::move(ri.value()) };
3840
}
41+
42+
[[nodiscard]] auto main() -> int{
43+
std::cout << f().ri + g().ri << "\n";
44+
}

regression-tests/test-results/run-tests.bat

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ REM This is intended to be run in the /test-results directory
22
REM A copy is in the parent directory just for convenience in case of accidental deletion.
33
REM
44
@echo off
5+
del *.cpp *.output
56
copy ..\*.cpp2 .
67
set count=0
78
for %%f in (mixed-*.cpp2) do (
@@ -16,4 +17,17 @@ for %%f in (pure2-*.cpp2) do (
1617
del %%f
1718
set /a count+=1
1819
)
19-
echo Done: %count% tests
20+
set cpp_count=0
21+
for %%A in (*.cpp) do set /a cpp_count+=1
22+
set err_count=0
23+
for %%A in (..\*error.cpp2) do set /a err_count+=1
24+
set /a "total_count=%cpp_count%+%err_count%"
25+
echo.
26+
echo Done: %count% .cpp2 tests compiled
27+
echo.
28+
echo. %cpp_count% .cpp files generated
29+
echo. %err_count% error test cases (should not generate .cpp)
30+
echo. %total_count% total
31+
if %total_count% NEQ %count% (
32+
echo. *** MISMATCH: should equal total tests run
33+
)

0 commit comments

Comments
 (0)