diff options
| author | Ellie Hermaszewska <ellieh@nvidia.com> | 2024-10-29 14:49:26 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-10-29 14:49:26 +0800 |
| commit | f65d756bff8d4c5cbc15bd0322a2ae8e6b896a21 (patch) | |
| tree | ea1d61342cd29368e19135000ec2948813096205 /tests | |
| parent | a729c15e9dce9f5116a38afc66329ab2ca4cea54 (diff) | |
format
* format
* Minor test fixes
* enable checking cpp format in ci
Diffstat (limited to 'tests')
19 files changed, 179 insertions, 160 deletions
diff --git a/tests/bindings/multi-file-defines.h b/tests/bindings/multi-file-defines.h index db0261158..e606016d7 100644 --- a/tests/bindings/multi-file-defines.h +++ b/tests/bindings/multi-file-defines.h @@ -9,37 +9,41 @@ #else #define R(X) X #define BEGIN_CBUFFER(NAME) struct SLANG_ParameterGroup_##NAME -#define END_CBUFFER(NAME, REG) ; cbuffer NAME : REG { SLANG_ParameterGroup_##NAME NAME; } +#define END_CBUFFER(NAME, REG) \ + ; \ + cbuffer NAME : REG \ + { \ + SLANG_ParameterGroup_##NAME NAME; \ + } #define CBUFFER_REF(NAME, FIELD) NAME.FIELD -#define PUBLIC -#define sharedC sharedC_0 -#define sharedCA sharedCA_0 -#define sharedCB sharedCB_0 -#define sharedCC sharedCC_0 -#define sharedCD sharedCD_0 - -#define vertexC vertexC_0 -#define vertexCA vertexCA_0 -#define vertexCB vertexCB_0 -#define vertexCC vertexCC_0 -#define vertexCD vertexCD_0 - -#define fragmentC fragmentC_0 -#define fragmentCA fragmentCA_0 -#define fragmentCB fragmentCB_0 -#define fragmentCC fragmentCC_0 -#define fragmentCD fragmentCD_0 - -#define sharedS sharedS_0 -#define sharedT sharedT_0 -#define sharedTV sharedTV_0 -#define sharedTF sharedTF_0 - -#define vertexS vertexS_0 -#define vertexT vertexT_0 - -#define fragmentS fragmentS_0 -#define fragmentT fragmentT_0 +#define PUBLIC +#define sharedC sharedC_0 +#define sharedCA sharedCA_0 +#define sharedCB sharedCB_0 +#define sharedCC sharedCC_0 +#define sharedCD sharedCD_0 + +#define vertexC vertexC_0 +#define vertexCA vertexCA_0 +#define vertexCB vertexCB_0 +#define vertexCC vertexCC_0 +#define vertexCD vertexCD_0 + +#define fragmentC fragmentC_0 +#define fragmentCA fragmentCA_0 +#define fragmentCB fragmentCB_0 +#define fragmentCC fragmentCC_0 +#define fragmentCD fragmentCD_0 + +#define sharedS sharedS_0 +#define sharedT sharedT_0 +#define sharedTV sharedTV_0 +#define sharedTF sharedTF_0 + +#define vertexS vertexS_0 +#define vertexT vertexT_0 + +#define fragmentS fragmentS_0 +#define fragmentT fragmentT_0 #endif - diff --git a/tests/cpp-compiler/c-compile-error.c b/tests/cpp-compiler/c-compile-error.c index ae36dd9c5..c81bfd315 100644 --- a/tests/cpp-compiler/c-compile-error.c +++ b/tests/cpp-compiler/c-compile-error.c @@ -1,12 +1,12 @@ -//TEST(smoke):CPP_COMPILER_EXECUTE: +// TEST(smoke):CPP_COMPILER_EXECUTE: -#include <stdlib.h> #include <stdio.h> +#include <stdlib.h> int main(int argc, char** argv) { int a = b + c; - + printf("Hello World!\n"); - return 0; + return 0; } diff --git a/tests/cpp-compiler/c-compile-link-error.c b/tests/cpp-compiler/c-compile-link-error.c index 08b93a38b..406f9cefb 100644 --- a/tests/cpp-compiler/c-compile-link-error.c +++ b/tests/cpp-compiler/c-compile-link-error.c @@ -1,12 +1,12 @@ -//TEST(smoke):CPP_COMPILER_EXECUTE: +// TEST(smoke):CPP_COMPILER_EXECUTE: -#include <stdlib.h> #include <stdio.h> +#include <stdlib.h> extern int thing; int main(int argc, char** argv) { printf("Hello World %d!\n", thing); - return 0; + return 0; } diff --git a/tests/cpp-compiler/c-compile-pass-through-shared-library.c b/tests/cpp-compiler/c-compile-pass-through-shared-library.c index 143817325..2dca175ee 100644 --- a/tests/cpp-compiler/c-compile-pass-through-shared-library.c +++ b/tests/cpp-compiler/c-compile-pass-through-shared-library.c @@ -1,24 +1,23 @@ -//TEST(smoke):CPP_COMPILER_COMPILE: -pass-through c -entry test -target callable +// TEST(smoke):CPP_COMPILER_COMPILE: -pass-through c -entry test -target callable -#include <stdlib.h> #include <stdio.h> -#include <string.h> - +#include <stdlib.h> +#include <string.h> + #if defined(_MSC_VER) -# define DLL_EXPORT __declspec(dllexport) -#else -# define DLL_EXPORT __attribute__((__visibility__("default"))) -#endif +#define DLL_EXPORT __declspec(dllexport) +#else +#define DLL_EXPORT __attribute__((__visibility__("default"))) +#endif -#ifdef __cplusplus +#ifdef __cplusplus #define EXTERN_C extern "C" #else -#define EXTERN_C -#endif - +#define EXTERN_C +#endif + EXTERN_C DLL_EXPORT int test(int intValue, const char* textValue, char* outTextValue) { strcpy(outTextValue, textValue); return intValue; } - diff --git a/tests/cpp-compiler/c-compile-shared-library-link-error.c b/tests/cpp-compiler/c-compile-shared-library-link-error.c index 1339a3b52..6f48fb435 100644 --- a/tests/cpp-compiler/c-compile-shared-library-link-error.c +++ b/tests/cpp-compiler/c-compile-shared-library-link-error.c @@ -1,27 +1,26 @@ -//TEST(smoke):CPP_COMPILER_SHARED_LIBRARY: +// TEST(smoke):CPP_COMPILER_SHARED_LIBRARY: -#include <stdlib.h> #include <stdio.h> -#include <string.h> - +#include <stdlib.h> +#include <string.h> + #if defined(_MSC_VER) -# define DLL_EXPORT __declspec(dllexport) -#else -//# define DLL_EXPORT -# define DLL_EXPORT __attribute__ ((dllexport)) __attribute__((__visibility__("default"))) -#endif +#define DLL_EXPORT __declspec(dllexport) +#else +// # define DLL_EXPORT +#define DLL_EXPORT __attribute__((dllexport)) __attribute__((__visibility__("default"))) +#endif -#ifdef __cplusplus +#ifdef __cplusplus #define EXTERN_C extern "C" #else -#define EXTERN_C -#endif +#define EXTERN_C +#endif extern int symbolNotFound; - + EXTERN_C DLL_EXPORT int test(int intValue, const char* textValue, char* outTextValue) { strcpy(outTextValue, textValue); return intValue + symbolNotFound; } - diff --git a/tests/cpp-compiler/c-compile-shared-library.c b/tests/cpp-compiler/c-compile-shared-library.c index 5ae61d65b..5af13b4c9 100644 --- a/tests/cpp-compiler/c-compile-shared-library.c +++ b/tests/cpp-compiler/c-compile-shared-library.c @@ -1,25 +1,24 @@ -//TEST(smoke,shared-library):CPP_COMPILER_SHARED_LIBRARY: +// TEST(smoke,shared-library):CPP_COMPILER_SHARED_LIBRARY: -#include <stdlib.h> #include <stdio.h> -#include <string.h> - +#include <stdlib.h> +#include <string.h> + #if defined(_MSC_VER) -# define DLL_EXPORT __declspec(dllexport) -#else -//# define DLL_EXPORT -# define DLL_EXPORT __attribute__ ((dllexport)) __attribute__((__visibility__("default"))) -#endif +#define DLL_EXPORT __declspec(dllexport) +#else +// # define DLL_EXPORT +#define DLL_EXPORT __attribute__((dllexport)) __attribute__((__visibility__("default"))) +#endif -#ifdef __cplusplus +#ifdef __cplusplus #define EXTERN_C extern "C" #else -#define EXTERN_C -#endif - +#define EXTERN_C +#endif + EXTERN_C DLL_EXPORT int test(int intValue, const char* textValue, char* outTextValue) { strcpy(outTextValue, textValue); return intValue; } - diff --git a/tests/cpp-compiler/c-compile.c b/tests/cpp-compiler/c-compile.c index 75fdbdaa4..f8cd3d41f 100644 --- a/tests/cpp-compiler/c-compile.c +++ b/tests/cpp-compiler/c-compile.c @@ -1,10 +1,10 @@ -//TEST(smoke):CPP_COMPILER_EXECUTE: +// TEST(smoke):CPP_COMPILER_EXECUTE: -#include <stdlib.h> #include <stdio.h> +#include <stdlib.h> int main(int argc, char** argv) { printf("Hello World!\n"); - return 0; + return 0; } diff --git a/tests/cpp-compiler/cpp-compile-shared-library.cpp b/tests/cpp-compiler/cpp-compile-shared-library.cpp index c802a57cd..a69e22899 100644 --- a/tests/cpp-compiler/cpp-compile-shared-library.cpp +++ b/tests/cpp-compiler/cpp-compile-shared-library.cpp @@ -1,21 +1,19 @@ -//TEST(smoke):CPP_COMPILER_SHARED_LIBRARY: +// TEST(smoke):CPP_COMPILER_SHARED_LIBRARY: -#include <stdlib.h> +#include <iostream> #include <stdio.h> +#include <stdlib.h> #include <string.h> - -#include <iostream> using namespace std; - + #if defined(_MSC_VER) -# define DLL_EXPORT __declspec(dllexport) +#define DLL_EXPORT __declspec(dllexport) #else -# define DLL_EXPORT __attribute__((__visibility__("default"))) -#endif - +#define DLL_EXPORT __attribute__((__visibility__("default"))) +#endif + extern "C" DLL_EXPORT int test(int intValue, const char* textValue, char* outTextValue) { strcpy(outTextValue, textValue); return intValue; } - diff --git a/tests/cpp-compiler/cpp-compile.cpp b/tests/cpp-compiler/cpp-compile.cpp index c3141a876..543b7e0be 100644 --- a/tests/cpp-compiler/cpp-compile.cpp +++ b/tests/cpp-compiler/cpp-compile.cpp @@ -1,9 +1,9 @@ -//TEST(smoke):CPP_COMPILER_EXECUTE: +// TEST(smoke):CPP_COMPILER_EXECUTE: #include <iostream> using namespace std; int main(int argc, char** argv) { cout << "Hello World!" << endl; - return 0; + return 0; } diff --git a/tests/cpp-compiler/simple-c-compile.c b/tests/cpp-compiler/simple-c-compile.c index 32b5561f1..5bdc0146e 100644 --- a/tests/cpp-compiler/simple-c-compile.c +++ b/tests/cpp-compiler/simple-c-compile.c @@ -1,10 +1,10 @@ -//TEST:SIMPLE: -entry main -target exe -pass-through c +// TEST:SIMPLE: -entry main -target exe -pass-through c -#include <stdlib.h> #include <stdio.h> +#include <stdlib.h> int main(int argc, char** argv) { printf("Hello World!\n"); - return 0; + return 0; } diff --git a/tests/front-end/parser-using-file-a.slang.h b/tests/front-end/parser-using-file-a.slang.h index becb69faa..8b381fd18 100644 --- a/tests/front-end/parser-using-file-a.slang.h +++ b/tests/front-end/parser-using-file-a.slang.h @@ -1,3 +1,6 @@ // this file exists to be included by "parser-using-file.slang" -float a(float x) { return x * x; } +float a(float x) +{ + return x * x; +} diff --git a/tests/front-end/pipeline-simple.slang.h b/tests/front-end/pipeline-simple.slang.h index 6a6dc1b1c..261b581ea 100644 --- a/tests/front-end/pipeline-simple.slang.h +++ b/tests/front-end/pipeline-simple.slang.h @@ -5,37 +5,38 @@ pipeline StandardPipeline { - [Pinned] - input world MeshVertex; - - world CoarseVertex;// : "glsl(vertex:projCoord)" using projCoord export standardExport; - world Fragment;// : "glsl" export fragmentExport; - - require @CoarseVertex vec4 projCoord; - - [VertexInput] - extern @CoarseVertex MeshVertex vertAttribIn; + [Pinned] input world MeshVertex; + + world CoarseVertex; // : "glsl(vertex:projCoord)" using projCoord export standardExport; + world Fragment; // : "glsl" export fragmentExport; + + require @CoarseVertex vec4 projCoord; + + [VertexInput] extern @CoarseVertex MeshVertex vertAttribIn; import(MeshVertex->CoarseVertex) vertexImport() { return project(vertAttribIn); } - + extern @Fragment CoarseVertex CoarseVertexIn; import(CoarseVertex->Fragment) standardImport() -// TODO(tfoley): this trait doesn't seem to be implemented on `vec3` -// require trait IsTriviallyPassable(CoarseVertex) + // TODO(tfoley): this trait doesn't seem to be implemented on `vec3` + // require trait IsTriviallyPassable(CoarseVertex) { return project(CoarseVertexIn); } - + stage vs : VertexShader { - World: CoarseVertex; - Position: projCoord; + World: + CoarseVertex; + Position: + projCoord; } - + stage fs : FragmentShader { - World: Fragment; + World: + Fragment; } }
\ No newline at end of file diff --git a/tests/preprocessor/file-identity/b.h b/tests/preprocessor/file-identity/b.h index ba131c653..c6b731349 100644 --- a/tests/preprocessor/file-identity/b.h +++ b/tests/preprocessor/file-identity/b.h @@ -3,9 +3,12 @@ #include "c.h" #ifdef B_H -# error "Shouldn't be included twice" +#error "Shouldn't be included twice" #endif #define B_H -float foo(float x) { return x; }
\ No newline at end of file +float foo(float x) +{ + return x; +}
\ No newline at end of file diff --git a/tests/preprocessor/file-identity/c.h b/tests/preprocessor/file-identity/c.h index eb6cd1c42..bb8e1c698 100644 --- a/tests/preprocessor/file-identity/c.h +++ b/tests/preprocessor/file-identity/c.h @@ -3,9 +3,12 @@ #include "b.h" #ifdef C_H -# error "c.h shouldn't be included twice" +#error "c.h shouldn't be included twice" #endif #define C_H -float bar(float x) { return x; }
\ No newline at end of file +float bar(float x) +{ + return x; +}
\ No newline at end of file diff --git a/tests/preprocessor/include-a.slang.h b/tests/preprocessor/include-a.slang.h index 8fecc6a98..6e2012874 100644 --- a/tests/preprocessor/include-a.slang.h +++ b/tests/preprocessor/include-a.slang.h @@ -1,3 +1,6 @@ // #include support -int bar() { return foo(); }
\ No newline at end of file +int bar() +{ + return foo(); +}
\ No newline at end of file diff --git a/tests/preprocessor/include-multiple.slang.expected b/tests/preprocessor/include-multiple.slang.expected index f9facb349..cf952be02 100644 --- a/tests/preprocessor/include-multiple.slang.expected +++ b/tests/preprocessor/include-multiple.slang.expected @@ -1,16 +1,16 @@ result code = -1 standard error = { tests/preprocessor/include-a.slang.h(3): error 30201: function 'bar' already has a body -int bar() { return foo(); } +int bar() ^~~ tests/preprocessor/include-a.slang.h(3): note: see previous definition of 'bar' -int bar() { return foo(); } +int bar() ^~~ tests/preprocessor/include-a.slang.h(3): error 30201: function 'bar' already has a body -int bar() { return foo(); } +int bar() ^~~ tests/preprocessor/include-a.slang.h(3): note: see previous definition of 'bar' -int bar() { return foo(); } +int bar() ^~~ } standard output = { diff --git a/tests/preprocessor/output-includes.slang.expected b/tests/preprocessor/output-includes.slang.expected index f2fbb64f2..e34ecee88 100644 --- a/tests/preprocessor/output-includes.slang.expected +++ b/tests/preprocessor/output-includes.slang.expected @@ -7,16 +7,16 @@ standard error = { (0): note: include 'tests/preprocessor/include-a.slang.h' (0): note: include 'tests/preprocessor/include-a.slang.h' tests/preprocessor/include-a.slang.h(3): error 30201: function 'bar' already has a body -int bar() { return foo(); } +int bar() ^~~ tests/preprocessor/include-a.slang.h(3): note: see previous definition of 'bar' -int bar() { return foo(); } +int bar() ^~~ tests/preprocessor/include-a.slang.h(3): error 30201: function 'bar' already has a body -int bar() { return foo(); } +int bar() ^~~ tests/preprocessor/include-a.slang.h(3): note: see previous definition of 'bar' -int bar() { return foo(); } +int bar() ^~~ } standard output = { diff --git a/tests/preprocessor/pragma-once-a.h b/tests/preprocessor/pragma-once-a.h index 6601919e4..e56b13dee 100644 --- a/tests/preprocessor/pragma-once-a.h +++ b/tests/preprocessor/pragma-once-a.h @@ -3,4 +3,7 @@ // Used by the `pragma-once.slang` test -float foo(float x) { return x; } +float foo(float x) +{ + return x; +} diff --git a/tests/reflection/multi-file-defines.h b/tests/reflection/multi-file-defines.h index 0948df378..d14a38cc5 100644 --- a/tests/reflection/multi-file-defines.h +++ b/tests/reflection/multi-file-defines.h @@ -9,37 +9,41 @@ #else #define R(X) /*X*/ #define BEGIN_CBUFFER(NAME) struct SLANG_ParameterGroup_##NAME -#define END_CBUFFER(NAME, REG) ; cbuffer NAME /*REG*/ { SLANG_ParameterGroup_##NAME NAME; } +#define END_CBUFFER(NAME, REG) \ + ; \ + cbuffer NAME /*REG*/ \ + { \ + SLANG_ParameterGroup_##NAME NAME; \ + } #define CBUFFER_REF(NAME, FIELD) NAME.FIELD #define PUBLIC -#define sharedC sharedC_0 -#define sharedCA sharedCA_0 -#define sharedCB sharedCB_0 -#define sharedCC sharedCC_0 -#define sharedCD sharedCD_0 - -#define vertexC vertexC_0 -#define vertexCA vertexCA_0 -#define vertexCB vertexCB_0 -#define vertexCC vertexCC_0 -#define vertexCD vertexCD_0 - -#define fragmentC fragmentC_0 -#define fragmentCA fragmentCA_0 -#define fragmentCB fragmentCB_0 -#define fragmentCC fragmentCC_0 -#define fragmentCD fragmentCD_0 - -#define sharedS sharedS_0 -#define sharedT sharedT_0 -#define sharedTV sharedTV_0 -#define sharedTF sharedTF_0 - -#define vertexS vertexS_0 -#define vertexT vertexT_0 - -#define fragmentS fragmentS_0 -#define fragmentT fragmentT_0 +#define sharedC sharedC_0 +#define sharedCA sharedCA_0 +#define sharedCB sharedCB_0 +#define sharedCC sharedCC_0 +#define sharedCD sharedCD_0 + +#define vertexC vertexC_0 +#define vertexCA vertexCA_0 +#define vertexCB vertexCB_0 +#define vertexCC vertexCC_0 +#define vertexCD vertexCD_0 + +#define fragmentC fragmentC_0 +#define fragmentCA fragmentCA_0 +#define fragmentCB fragmentCB_0 +#define fragmentCC fragmentCC_0 +#define fragmentCD fragmentCD_0 + +#define sharedS sharedS_0 +#define sharedT sharedT_0 +#define sharedTV sharedTV_0 +#define sharedTF sharedTF_0 + +#define vertexS vertexS_0 +#define vertexT vertexT_0 + +#define fragmentS fragmentS_0 +#define fragmentT fragmentT_0 #endif - |
