def assertFormatMatches(self, format_str, data_type, native, memory_le, memory_be): fd = pfg.describe(format_str) self.assertEqual(data_type, fd.data_type) self.assertEqual(native, fd.native) self.assertEqual(memory_le, fd.memory_le) self.assertEqual(memory_be, fd.memory_be)
def test_describes_format_with_native_description(self): pfg.main(["pfg.py", "describe", "VK_FORMAT_R5G6B5_UNORM_PACK16"]) description = pfg.describe("VK_FORMAT_R5G6B5_UNORM_PACK16") output = self.get_stdout_without_error() self.assertIn(native_to_str(description.native), output) self.assertIn(memory_to_str(description.memory_le), output) self.assertIn(memory_to_str(description.memory_be), output) self.assertIn("Native 16-bit type", output)
def test_describes_format_without_native_description(self): pfg.main(["pfg.py", "describe", "VK_FORMAT_R8G8B8_UNORM"]) description = pfg.describe("VK_FORMAT_R8G8B8_UNORM") output = self.get_stdout_without_error() self.assertIn(" " + description.data_type, output) self.assertIn(memory_to_str(description.memory_le), output) self.assertIn(memory_to_str(description.memory_be), output) self.assertIn("Bytes in memory", output)
def test_describes_format_without_bit_indices(self): pfg.main(["pfg.py", "describe", "--hide-bit-indices", "VK_FORMAT_R5G6B5_UNORM_PACK16"]) description = pfg.describe("VK_FORMAT_R5G6B5_UNORM_PACK16") output = self.get_stdout_without_error() self.assertIn(" " + description.data_type, output) self.assertIn(remove_subscripts(native_to_str(description.native)), output) self.assertIn(remove_subscripts(memory_to_str(description.memory_le)), output) self.assertIn(remove_subscripts(memory_to_str(description.memory_be)), output) self.assertIn("Native 16-bit type", output)
def assertFormatIsUnknown(self, format_str): self.assertIsNone(pfg.describe(format_str))