Commit Graph

19 Commits

Author SHA1 Message Date
Lei Zhang
4c2db8347e Simplify methods for compilation failure in test framework.
Remove  CompileWithFormatFailure() and make CompileFailure() accept
a default argument.
2015-10-26 12:55:33 -04:00
David Neto
b5dc8fcd5d Support strings with up to 65535 chars, and null.
Move the definition of spv_instruction_t to an internal
header file, since it now depends on C++ and is not
used by the external interface.

Use a std::vector<uint32_t> in spv_instruction_t
instead of a fixed size array.
2015-10-26 12:55:33 -04:00
David Neto
42bfd4bfab Assembly test for OpSwitch
Removes old weak and fragile tests for OpSwitch.

Adds spvtest::TextToBinaryTest::CompileWithFormatFailure
2015-10-26 12:55:33 -04:00
Andrew Woloszyn
13804e5d63 All values now represent symbolic names instead of mixed with numeric.
Also removed un-necessary heap-allocation of spv_named_id_table.
This removed the necessity to expose a function to create/destroy it
and simplified the interface.
2015-10-26 12:55:33 -04:00
David Neto
1b5fd4962e Put the test fixture into spvtest namespace.
All test utility code should go into the spvtest namespace.
2015-10-26 12:55:33 -04:00
Lei Zhang
184c76dbaf Let EncodeAndDecodeSuccessfully remove preamble comments. 2015-10-26 12:55:33 -04:00
Dejan Mircevski
58fc88e2ee Simplify format indication in CompileSuccesfully(). 2015-10-26 12:55:33 -04:00
Lei Zhang
06efdc59e1 Add an API parameter to choose assembly syntax format for assembler.
Added a new enum for supported assembly syntax formats:
Canonical Assembly Format (CAF) and Assignment Assembly Format (AAF).

Updated assembler interface functions to support choice of assembly
syntax format.
2015-10-26 12:54:39 -04:00
David Neto
c88dcd6a72 Add OpNop, OpUndef tests for spvTextToBinary
Add text_fixture::TextToBinaryTestBase::CompiledInstructions,
to more easily just examine the generated instructions by skipping
over the header.

Add spvtest::MakeInstruction utility function to easily generate
a vector containing an opcode and its operands.
2015-10-26 12:54:39 -04:00
Lei Zhang
574352c7a9 Fix interface function calls to the new API. 2015-10-26 12:54:39 -04:00
Lei Zhang
610c525865 Preserve float values during encoding and decoding roundtrip. 2015-10-26 12:54:39 -04:00
Andrew Woloszyn
cfeac48a37 Removed the ambiguity in the API for cleaning input vs output data.
Previous the api used spv_text_t and spv_binary_t for both input
and output, but depending on the usage, you either MUST
call spvBinaryDestroy or you MUST NOT call spvBinaryDestroy on the
pointer.
2015-10-26 12:54:39 -04:00
David Neto
cac38f92dd Simplify uses of spvBinaryDestroy in tests
Always try to destroy the binary during common methods
of test fixtures.  This is safe if no other code in the test
attempted to destroy the binary.

Take advantage of the fact spvBinaryDestroy is a no-op on a nullptr,
by eliminating the null pointer check in the caller.
2015-10-26 12:54:39 -04:00
Dejan Mircevski
ea5a2a5242 Add invalid-operand tests for !<integer>. 2015-10-26 12:52:01 -04:00
Dejan Mircevski
6c03f87490 Print failing assembly text in CompileSuccessfully(). 2015-10-26 12:52:01 -04:00
Dejan Mircevski
0a8f219d1e Add a few unit tests for !<integer>. More to come.
Start using GMock: modify CMakeLists, fix googletest URL in readme.

Add useful utilities to the TestFixture class.  Also make it conform to
go/gunit recommendations about setup/teardown.
2015-10-26 12:52:01 -04:00
Dejan Mircevski
73d7082245 Put test classes in anonymous namespace.
Put TestFixture.h classes in a namespace.

Remove unused #includes.
2015-10-26 12:52:01 -04:00
Andrew Woloszyn
1d2a87ed1b Added the initial set of glsl450 instructions.
Also rewrote the extended-instruction tests so that they would actually
make sure that the instruction actually appears in the output.
2015-08-24 15:04:49 -04:00
Lei Zhang
fb76d81aa0 Move test fixture into a separate header file so it can be reused. 2015-08-24 15:04:45 -04:00