blob: b80bed4cb0663125be5175b900a8481ab76985e6 [file] [log] [blame]
lowRISC Contributors802543a2019-08-31 12:12:56 +01001# Copyright lowRISC contributors.
2# Licensed under the Apache License, Version 2.0, see LICENSE for details.
3# SPDX-License-Identifier: Apache-2.0
4
5import unittest
6
7from reggen import gen_rtl
8
9
10class TestFieldCheck(unittest.TestCase):
11 def test_check_bool(self):
12 arg = {'field1': "true", 'field2': "false", 'field3': "True"}
13 result = gen_rtl.check_field_bool(arg, 'field1', False)
14 self.assertTrue(result)
15 result = gen_rtl.check_field_bool(arg, 'field2', True)
16 self.assertFalse(result)
17 result = gen_rtl.check_field_bool(arg, 'field3', False)
18 self.assertFalse(result)
19 result = gen_rtl.check_field_bool(arg, 'field4', False)
20 self.assertFalse(result)