Coverage for tests/fastcap/fastcap_runner_test.py: 100%

22 statements  

« prev     ^ index     » next       coverage.py v7.6.9, created at 2024-12-17 17:24 +0000

1# 

2# -------------------------------------------------------------------------------- 

3# SPDX-FileCopyrightText: 2024 Martin Jan Köhler and Harald Pretl 

4# Johannes Kepler University, Institute for Integrated Circuits. 

5# 

6# This file is part of KPEX  

7# (see https://github.com/martinjankoehler/klayout-pex). 

8# 

9# This program is free software: you can redistribute it and/or modify 

10# it under the terms of the GNU General Public License as published by 

11# the Free Software Foundation, either version 3 of the License, or 

12# (at your option) any later version. 

13# 

14# This program is distributed in the hope that it will be useful, 

15# but WITHOUT ANY WARRANTY; without even the implied warranty of 

16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 

17# GNU General Public License for more details. 

18# 

19# You should have received a copy of the GNU General Public License 

20# along with this program. If not, see <http://www.gnu.org/licenses/>. 

21# SPDX-License-Identifier: GPL-3.0-or-later 

22# -------------------------------------------------------------------------------- 

23# 

24import allure 

25import os 

26import unittest 

27 

28from klayout_pex.fastcap.fastcap_runner import fastcap_parse_capacitance_matrix 

29 

30 

31@allure.parent_suite("Unit Tests") 

32@allure.tag("Capacitance", "FastCap") 

33class Test(unittest.TestCase): 

34 @property 

35 def fastcap_testdata_dir(self) -> str: 

36 return os.path.realpath(os.path.join(__file__, '..', '..', '..', 'testdata', 'fastcap')) 

37 

38 def test_fastcap_parse_capacitance_matrix(self): 

39 testdata_path = os.path.join(self.fastcap_testdata_dir, 'cap_mim_m3_w18p9_l5p1__REDUX122_FastCap_Output.txt') 

40 obtained_matrix = fastcap_parse_capacitance_matrix(log_path=testdata_path) 

41 self.assertEqual(4, len(obtained_matrix.rows)) 

42 self.assertEqual(4, len(obtained_matrix.rows[0])) 

43 self.assertEqual(4, len(obtained_matrix.rows[1])) 

44 self.assertEqual(4, len(obtained_matrix.rows[2])) 

45 self.assertEqual(4, len(obtained_matrix.rows[3])) 

46 self.assertEqual( 

47 ['$1%GROUP2', '$1%GROUP2', '$2%GROUP3', '$2%GROUP3'], 

48 obtained_matrix.conductor_names 

49 ) 

50 

51 output_path = os.path.join(self.fastcap_testdata_dir, 'cap_mim_m3_w18p9_l5p1__REDUX122_FastCap_Result_Matrix.csv') 

52 obtained_matrix.write_csv(output_path=output_path, separator=';') 

53 allure.attach.file(output_path, attachment_type=allure.attachment_type.CSV)