Commit Graph

734 Commits

Author SHA1 Message Date
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
David Neto
9fa9157c4d Add bin-to-text test for operand with operands 2015-10-26 12:52:01 -04:00
David Neto
c9a23a6fd5 Add binary-to-text test for single instruction
This is easier to debug!

Binary-to-text testing needs more tests, and more
specific tests.  That's for future work.
2015-10-26 12:52:01 -04:00
David Neto
e7ee4c4476 Getting the next word respects quoting and escaping.
Use double quotes (").  They can be interspersed with
other whitespace characters, just like shell quoting.

A backslash (\) always escapes the next character.

The end of the stream always terminates the word.

Add AutoText struct to unit test utilities, to easily
make spv_text_t values and reference them as spv_text values.
2015-10-26 12:52:01 -04:00
Dejan Mircevski
f184109d7b Move ImmediateInt tests into their own file.
This is in preparation of adding many more tests in accordance with the
evolved spec.

Also sort the test-source lines in CMakeLists.
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
David Neto
574884cd7e Getting the next word ends at a comment (;) 2015-10-26 12:52:01 -04:00
David Neto
98290a243e String literals must be quoted. 2015-10-26 12:52:01 -04:00
David Neto
affa696027 Fix some bugs in parsing literals.
- a single hyphen is a string, not a number.
- a string with more than one period is a string, not a number
- check for string overflow

Add some unit tests
2015-10-26 12:52:01 -04:00
Lei Zhang
5b73214223 Add GLSL std450 extended instruction 72-80. 2015-10-26 12:52:01 -04:00
Dejan Mircevski
afdbd2d303 Add std450 instructions 53-64. 2015-10-26 12:52:01 -04:00
Lei Zhang
3cb589639d Add GLSL std450 extended instruction 65-71. 2015-10-26 12:52:01 -04:00
Lei Zhang
85d4d6d677 Add test for Modf and ModfStruct. 2015-10-26 12:52:01 -04:00
Dejan Mircevski
c48fcce978 Add std450 instructions 49-52. 2015-10-26 12:52:01 -04:00
Lei Zhang
dca65b3f8c Reformat GLSL std450 extended instruction table.
Also add test for Smoothstep.
2015-10-26 12:52:01 -04:00
Dejan Mircevski
c4ba8821e7 Add tests for Atan2 and Pow.
Fix a typo in "ParameterizedExtInst."
2015-10-26 12:52:01 -04:00
Lei Zhang
65bfc4d585 Unify tests for GLSL std450 extended instructions.
Previously we had two tests: one checks test to binary, the other
checks round trip. This patch merges the check in the former to
the latter.
2015-10-26 12:52:01 -04:00
Lei Zhang
e5ae7f677f Add GLSL std450 instructions 35-48. 2015-10-26 12:52:01 -04:00
Lei Zhang
0e149d7cc4 Move tests for GLSL std450 instructions to a separate file. 2015-10-26 12:52:01 -04:00
Dejan Mircevski
a5c171544b Add std450 instructions 25-34. 2015-10-26 12:52:01 -04:00
Lei Zhang
8a37520908 Disassemble in the format of "<result-id> = <opcode> <operand>..". 2015-10-26 12:52:01 -04:00
Lei Zhang
abafd5e674 Only use '%' as variable name prefix.
Since now we can distinguish between def and use according to
the variable's location, there is no need to keep two variable
prefixes.

Also reformat tests to use the value generating instruction
format ("<result-id> = <opcode> <operand>..").
2015-08-24 15:05:11 -04:00
Lei Zhang
977e9bcfc6 Bugfix: report the correct location for wrong opcode.
Also add more tests for the "<result-id> = <opcode> <operand>.."
format.
2015-08-24 15:05:08 -04:00
Lei Zhang
ee87cc2a1e Fix TextAdvance() problems involving whitespace around comment lines.
Fix the bug that TextAdvance() forgot to skip whitespace at the
beginning of the next line after a comment line.

Fix the bug that TextAdvanceLine() increase line number after going
over a character.
2015-08-24 15:05:05 -04:00
Andrew Woloszyn
2facab2d08 Added stream operators for spv_binary_t and std::vector<uint32_t> 2015-08-24 15:05:02 -04:00
Lei Zhang
dfc50086a6 Support "<result-id> = <opcode> <operand>.." format. 2015-08-24 15:04:58 -04:00
Andrew Woloszyn
0d350b5992 Make the disassembler print the Extended instruction name.
This allows the disassembled output to more closely follow the
original assembly.
2015-08-24 15:04:55 -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
Kenneth Benzie
67b649fa01 Merge branch 'update-header-to-rev31' into 'master'
Update external headers to rev 31

See merge request !3
2015-08-18 05:34:27 -04:00
David Neto
f6184a8b37 Parenthesize SPV_BIT macro to avoid surprises. 2015-08-17 17:01:42 -04:00
Lei Zhang
604e5cea12 Update spirv.h to revision 31.
For enum Capability and enum Op, not all newly added enumerants are
registered into capabilityInfoEntries and opcodeTableEntries yet.
That will come in following commits.
2015-08-17 11:40:24 -04:00
Lei Zhang
3a7315498f Fix failing tests.
The generator number is set to SPV_GENERATOR_KHRONOS in the
spvBinaryHeaderSet function, so tests should catch up.
2015-07-30 15:21:42 -04:00
Kenneth Benzie (Benie)
83e5a29b06 Code drop of the Codeplay spirv-tools source.
This commit contains the source for the SPIRV static library, spirv-as,
spirv-dis, and spirv-val tools.
2015-05-22 18:26:19 +01:00