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

9 statements  

« prev     ^ index     » next       coverage.py v7.4.4, created at 2024-03-28 08:42 +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 

9# First party libraries 

10from tsfpga.vivado.hierarchical_utilization_parser import HierarchicalUtilizationParser 

11 

12 

13def test_utilization_parser(): 

14 report = """ 

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

16Also writing pipes | | | | should be fine 

17Random sections of dashes should be fine: 

18--------------------------------------------------------------- 

19-----------------------+----------------------------+---------- 

20But this should hit: 

21| x | x | a | b | c | d | 

22~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 

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

24""" 

25 

26 result = HierarchicalUtilizationParser.get_size(report) 

27 assert result["a"] == 1 

28 assert result["b"] == 2 

29 assert result["c"] == 3 

30 assert result["d"] == 4 

31 assert len(result) == 4