mirror of
https://github.com/roytam1/basilisk55.git
synced 2026-06-20 07:29:01 +00:00
f6fa831116
- Update libnestegg from upstream (dad1c31db) - [webm] Store LastSeenFrame dimensions as an nsIntSize (ae3cdb4be) - [vpx] Store VPXDecoder codec as an enum (5a83ed9eb) - Add Span support to MediaRawData (2a00bf126) - Implement keyframe and framesize VPXDecoder helpers (55c6aa422) - Call VPXDecoder libvpx wrappers for WebM (3ec54eeac) - [webm] Treat demuxing errors differently than EOS (632b67483) - [webm] Don't reject seeks with EOS (81c39ba87) - Port the libvpx mozbuild generator to aom (07c17b6b9) - Import aom library (68569dee1) - Generate build description for libaom (a66e91651) - Add --enable-av1 configure switch (99ed16064) - Add AOMDecoder (9aea199da) - Add AOMDecoder to AgnosticDecoderModule (3e0443e4c) - Recognize AV1 in WebMDemuxer (ee2cb65e2) - Add missing includes to WebMDemuxer (e5545e10a) - Add aom to the list of thirdparty code (e8480f8a7) - [aom] Remove 32-bit Mac OS build config (08619db14) - [aom] Enable YASM (f45278950) - Make AOMDecoder actually build (26dc168e3) - Remove aom_codec_stream_info_t sz field references (1036d1fa0) - Add av1 to MediaSource.isTypeSupported (0cc51bc10) - Update aom to slightly newer commit ID (df9477dfa) - Fix typo (build bustage) (4b5e22956) - Add missing includes to FFmpegLibWrapper (dddc2aa9e) - [av1] Clean up duplicate filenames check (afda5e384) - [aom] Add x86-win32-gcc config (857b86f25) - Make aom_config.asm match upstream (ecdaf7930) - [aom] Filter out CONFIG_EXT_PARTITION_TYPES (4121d7571) - [aom] Remove unused option (77887af9c) - Update aom to commit id f5bdeac22930ff4c6b219be49c843db35970b918 (7369c7d7a) - Export aom_config.h (21598d1bd) - [aom] Fix stream info peeking (e394e2049) - [aom] Resample high bit depth frames (4653be960) - [aom] Don't resample 8-bit images (0c98b7165) - [aom] Fix win32 debug build (01eb57073) - Update aom to commit id e87fb2378f01103d5d6e477a4ef6892dc714e614 (ec910d814) - [av1] Fix build issues (464c3130f) - Fix aom compile errors with VS2015 (125aff11b) - Add Python cmake parser (39e842a83) - Add generate_sources_mozbuild.py (5c0c6c73a) - Update generate_sources_mozbuild.sh (b425400e9) - Add aom_version.h (c410f04e8) - Add support for SSE 4.2 to libaom moz.build (14805f6dd) - Update aom to v1.0.0 (bbcc64772) - Do not build aomstats unless examples are enabled (ab5b4462a) - [aom] Fixup moz.build (4f63fc3bd) - Updates to AOMDecoder for aom v1.0.0 (ee1300453) - Add missing : to libaom moz.build (9469bc196) - [aom] No longer necessary to run lint_config.sh anymore (a4d3c59dc) - Update libaom to rev b25610052a1398032320008d69b51d2da94f5928 (b8df135c9) - [aom] Only build stats code if examples are enabled (ba5a1ea60) - Update libaom vendor scripts to account for upstream changes (41fbdea45) - Update libaom to commit ID 1e227d41f0616de9548a673a83a21ef990b62591 (d2499ead9) - Put AV1 codec behind a pref (6ddf66542) - Fix canPlayType/isTypeSupported for AV1 content (e5b30fc95) - Downsample av1 images unconditionally (070c2cb24) - Use larger stack for media decoder threads (47a01617e) - Add support for AV1 in MP4 (29f718ef7) - Ensure we correctly parse the finalized codec string for av1 (23013dda6) - Revert "Add support for AV1 in MP4" (192199b03) - Add support to libstagefright for AV1 FourCCs (df59d06fd) - Add support to libstagefright for AV1 FourCCs (part 2) (4d8b7a376) - Add AV1 support to MP4Decoder. (56c26d867)
191 lines
7.1 KiB
Python
191 lines
7.1 KiB
Python
# This Source Code Form is subject to the terms of the Mozilla Public
|
|
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
from pyparsing import ParseException
|
|
import unittest
|
|
|
|
import cmakeparser as cp
|
|
|
|
class TestCMakeParser(unittest.TestCase):
|
|
def test_arguments(self):
|
|
self.assertEqual(cp.arguments.parseString('1').asList(), ['1'])
|
|
self.assertEqual(cp.arguments.parseString('(1 2)').asList(),
|
|
['(', '1', '2', ')'])
|
|
|
|
def test_command(self):
|
|
self.assertEqual(cp.command.parseString('blah()').asList(),
|
|
[['blah', '(', ')']])
|
|
self.assertEqual(cp.command.parseString('blah(1)').asList(),
|
|
[['blah', '(', '1', ')']])
|
|
self.assertEqual(cp.command.parseString('blah(1 (2 3))').asList(),
|
|
[['blah', '(', '1', '(', '2', '3', ')', ')']])
|
|
|
|
def test_evaluate_boolean(self):
|
|
self.assertTrue(cp.evaluate_boolean({}, ['TRUE']))
|
|
self.assertFalse(cp.evaluate_boolean({}, ['NOT', 'TRUE']))
|
|
self.assertFalse(cp.evaluate_boolean({}, ['TRUE', 'AND', 'FALSE']))
|
|
self.assertTrue(cp.evaluate_boolean({}, ['ABC', 'MATCHES', '^AB']))
|
|
self.assertTrue(cp.evaluate_boolean({}, ['TRUE', 'OR', 'FALSE']))
|
|
self.assertTrue(cp.evaluate_boolean({}, ['ABC', 'STREQUAL', 'ABC']))
|
|
self.assertTrue(cp.evaluate_boolean({'ABC': '1'}, ['ABC']))
|
|
self.assertFalse(cp.evaluate_boolean({'ABC': '0'}, ['${ABC}']))
|
|
self.assertFalse(cp.evaluate_boolean({}, ['ABC']))
|
|
self.assertFalse(cp.evaluate_boolean({}, ['${ABC}']))
|
|
self.assertTrue(cp.evaluate_boolean({'YES_ABC': 1, 'VAL': 'ABC'},
|
|
['YES_${VAL}']))
|
|
self.assertTrue(cp.evaluate_boolean({'ABC': 'DEF', 'DEF': 1},
|
|
['${ABC}']))
|
|
self.assertTrue(cp.evaluate_boolean({}, ['FALSE', 'OR', '(', 'FALSE', 'OR', 'TRUE', ')']))
|
|
self.assertFalse(cp.evaluate_boolean({}, ['FALSE', 'OR', '(', 'FALSE', 'AND', 'TRUE', ')']))
|
|
|
|
def test_foreach(self):
|
|
s = """
|
|
set(STUFF A B C D E F)
|
|
foreach(item ${STUFF})
|
|
set(YES_${item} 1)
|
|
endforeach ()
|
|
"""
|
|
parsed = cp.cmake.parseString(s)
|
|
variables = {}
|
|
cp.evaluate(variables, [], parsed)
|
|
for k in ['A', 'B', 'C', 'D', 'E', 'F']:
|
|
self.assertEqual(variables['YES_%s' % k], '1')
|
|
|
|
s = """
|
|
set(STUFF "A;B;C;D;E;F")
|
|
foreach(item ${STUFF})
|
|
set(${item} 1)
|
|
endforeach ()
|
|
"""
|
|
parsed = cp.cmake.parseString(s)
|
|
variables = {}
|
|
cp.evaluate(variables, [], parsed)
|
|
for k in ['A', 'B', 'C', 'D', 'E', 'F']:
|
|
self.assertEqual(variables[k], '1')
|
|
|
|
s = """
|
|
set(STUFF D E F)
|
|
foreach(item A B C ${STUFF})
|
|
set(${item} 1)
|
|
endforeach ()
|
|
"""
|
|
parsed = cp.cmake.parseString(s)
|
|
variables = {}
|
|
cp.evaluate(variables, [], parsed)
|
|
for k in ['A', 'B', 'C', 'D', 'E', 'F']:
|
|
self.assertEqual(variables[k], '1')
|
|
|
|
def test_list(self):
|
|
s = 'list(APPEND TEST 1 1 2 3 5 8 13)'
|
|
parsed = cp.cmake.parseString(s)
|
|
variables = {}
|
|
cache_variables = []
|
|
cp.evaluate(variables, cache_variables, parsed)
|
|
self.assertEqual(variables['TEST'], '1 1 2 3 5 8 13')
|
|
self.assertEqual(len(cache_variables), 0)
|
|
|
|
s = """
|
|
set(TEST 1)
|
|
list(APPEND TEST 1 2 3 5 8 13)
|
|
"""
|
|
parsed = cp.cmake.parseString(s)
|
|
variables = {}
|
|
cache_variables = []
|
|
cp.evaluate(variables, cache_variables, parsed)
|
|
self.assertEqual(variables['TEST'], '1 1 2 3 5 8 13')
|
|
self.assertEqual(len(cache_variables), 0)
|
|
|
|
def test_malformed_input(self):
|
|
self.assertEqual(len(cp.cmake.parseString('func ((A)')), 0)
|
|
self.assertEqual(len(cp.cmake.parseString('cmd"arg"(arg2)')), 0)
|
|
self.assertRaises(ParseException, cp.command.parseString, 'func ((A)')
|
|
self.assertRaises(ParseException, cp.identifier.parseString,
|
|
'-asdlf')
|
|
self.assertEqual(cp.identifier.parseString('asd-lf')[0], 'asd')
|
|
self.assertRaises(ParseException, cp.quoted_argument.parseString,
|
|
'blah"')
|
|
s = """
|
|
" blah blah
|
|
blah
|
|
"""
|
|
self.assertRaises(ParseException, cp.quoted_argument.parseString,
|
|
s)
|
|
self.assertRaises(ParseException, cp.quoted_argument.parseString,
|
|
'asdlf')
|
|
self.assertRaises(ParseException, cp.unquoted_argument.parseString,
|
|
'#asdflkj')
|
|
|
|
def test_parse_if(self):
|
|
s = """
|
|
if (A)
|
|
B()
|
|
elseif (C)
|
|
D()
|
|
elseif (E)
|
|
F()
|
|
else ()
|
|
H()
|
|
endif ()
|
|
I()
|
|
"""
|
|
parsed = cp.cmake.parseString(s)
|
|
self.assertEqual(len(parsed), 10)
|
|
end, conditions = cp.parse_if(parsed, 0)
|
|
self.assertEqual(parsed[end][0], 'endif')
|
|
self.assertEqual(len(conditions), 4)
|
|
self.assertEqual(conditions[0][0], ['A'])
|
|
self.assertEqual(conditions[0][1][0], parsed[1])
|
|
self.assertEqual(conditions[1][0], ['C'])
|
|
self.assertEqual(conditions[1][1][0], parsed[3])
|
|
self.assertEqual(conditions[2][0], ['E'])
|
|
self.assertEqual(conditions[2][1][0], parsed[5])
|
|
self.assertEqual(conditions[3][0], ['TRUE'])
|
|
self.assertEqual(conditions[3][1][0], parsed[7])
|
|
|
|
def test_return(self):
|
|
s = """
|
|
set(TEST 2)
|
|
if (true)
|
|
return()
|
|
endif ()
|
|
set(TEST 3)
|
|
"""
|
|
parsed = cp.cmake.parseString(s)
|
|
variables = {}
|
|
cache_variables = []
|
|
cp.evaluate(variables, cache_variables, parsed)
|
|
self.assertEqual(variables['TEST'], '2')
|
|
self.assertEqual(len(cache_variables), 0)
|
|
|
|
def test_set(self):
|
|
s = """set(TEST 2)"""
|
|
parsed = cp.cmake.parseString(s)
|
|
variables = {}
|
|
cache_variables = []
|
|
cp.evaluate(variables, cache_variables, parsed)
|
|
self.assertEqual(variables['TEST'], '2')
|
|
self.assertEqual(len(cache_variables), 0)
|
|
|
|
s = """set(TEST 3 CACHE "documentation")"""
|
|
parsed = cp.cmake.parseString(s)
|
|
variables = {}
|
|
cache_variables = []
|
|
cp.evaluate(variables, cache_variables, parsed)
|
|
self.assertEqual(variables['TEST'], '3')
|
|
self.assertTrue('TEST' in cache_variables)
|
|
|
|
s = """set(TEST A B C D)"""
|
|
parsed = cp.cmake.parseString(s)
|
|
variables = {}
|
|
cp.evaluate(variables, [], parsed)
|
|
self.assertEqual(variables['TEST'], 'A B C D')
|
|
|
|
s = """set(TEST ${TEST} E F G H)"""
|
|
parsed = cp.cmake.parseString(s)
|
|
cp.evaluate(variables, [], parsed)
|
|
self.assertEqual(variables['TEST'], 'A B C D E F G H')
|
|
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|