Coverage for tsfpga/vivado/test/test_hierarchical_utilization_parser.py: 100%

9 statements  

« prev     ^ index     » next       coverage.py v7.6.12, created at 2025-02-21 20:51 +0000

1# -------------------------------------------------------------------------------------------------- 

2# Copyright (c) Lukas Vik. All rights reserved. 

3# 

4# This file is part of the tsfpga project, a project platform for modern FPGA development. 

5# https://tsfpga.com 

6# https://github.com/tsfpga/tsfpga 

7# -------------------------------------------------------------------------------------------------- 

8 

9from tsfpga.vivado.hierarchical_utilization_parser import HierarchicalUtilizationParser 

10 

11 

12def test_utilization_parser(): 

13 report = """ 

14Writing top or top) or (top here should not cause issues 

15Also writing pipes | | | | should be fine 

16Random sections of dashes should be fine: 

17--------------------------------------------------------------- 

18-----------------------+----------------------------+---------- 

19But this should hit: 

20| x | x | a | b | c | d | 

21~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 

22| x | (top) | 1 | 2 | 3 | 4 | 

23""" 

24 

25 result = HierarchicalUtilizationParser.get_size(report) 

26 assert result["a"] == 1 

27 assert result["b"] == 2 

28 assert result["c"] == 3 

29 assert result["d"] == 4 

30 assert len(result) == 4