CodeGenSPIRVTest.cpp 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. //===- unittests/SPIRV/CodeGenSPIRVTest.cpp ---- Run CodeGenSPIRV tests ---===//
  2. //
  3. // The LLVM Compiler Infrastructure
  4. //
  5. // This file is distributed under the University of Illinois Open Source
  6. // License. See LICENSE.TXT for details.
  7. //
  8. //===----------------------------------------------------------------------===//
  9. #include "FileTestFixture.h"
  10. #include "WholeFileTestFixture.h"
  11. namespace {
  12. using clang::spirv::FileTest;
  13. using clang::spirv::WholeFileTest;
  14. // === Whole output tests ===
  15. TEST_F(WholeFileTest, EmptyVoidMain) {
  16. runWholeFileTest("empty-void-main.hlsl2spv", /*generateHeader*/ true);
  17. }
  18. TEST_F(WholeFileTest, PassThruPixelShader) {
  19. runWholeFileTest("passthru-ps.hlsl2spv", /*generateHeader*/ true);
  20. }
  21. TEST_F(WholeFileTest, PassThruVertexShader) {
  22. runWholeFileTest("passthru-vs.hlsl2spv", /*generateHeader*/ true);
  23. }
  24. TEST_F(WholeFileTest, ConstantPixelShader) {
  25. runWholeFileTest("constant-ps.hlsl2spv", /*generateHeader*/ true);
  26. }
  27. // === Partial output tests ===
  28. TEST_F(FileTest, ScalarTypes) { runFileTest("type.scalar.hlsl"); }
  29. TEST_F(FileTest, ScalarConstants) { runFileTest("constant.scalar.hlsl"); }
  30. TEST_F(FileTest, UnaryOpPrefixIncrement) {
  31. runFileTest("unary-op.prefix-inc.hlsl");
  32. }
  33. TEST_F(FileTest, BinaryOpAssign) { runFileTest("binary-op.assign.hlsl"); }
  34. TEST_F(FileTest, BinaryOpScalarArithmetic) {
  35. runFileTest("binary-op.arithmetic.scalar.hlsl");
  36. }
  37. TEST_F(FileTest, BinaryOpScalarComparison) {
  38. runFileTest("binary-op.comparison.scalar.hlsl");
  39. }
  40. TEST_F(FileTest, IfStmtPlainAssign) { runFileTest("if-stmt.plain.hlsl"); }
  41. TEST_F(FileTest, IfStmtNestedIfStmt) { runFileTest("if-stmt.nested.hlsl"); }
  42. TEST_F(FileTest, ForStmtPlainAssign) { runFileTest("for-stmt.plain.hlsl"); }
  43. TEST_F(FileTest, ForStmtNestedForStmt) { runFileTest("for-stmt.nested.hlsl"); }
  44. TEST_F(FileTest, ControlFlowNestedIfForStmt) { runFileTest("cf.if.for.hlsl"); }
  45. } // namespace