|
43 | 43 | class FileSets(TestCase): |
44 | 44 | def test_Parsing(self): |
45 | 45 | xprPath = Path.cwd() / "tests/VivadoProject/StopWatch/project/StopWatch.xpr" |
46 | | - print() |
47 | | - print(f"{xprPath}") |
| 46 | + # print() |
| 47 | + # print(f"{xprPath}") |
48 | 48 | xprFile = VivadoProjectFile(xprPath) |
49 | 49 | xprFile.Parse() |
50 | 50 |
|
51 | 51 | project = xprFile.ProjectModel |
52 | | - print(f"Project: {project.Name}") |
53 | | - for designName, design in project.Designs.items(): |
54 | | - print(f" Design: {designName}") |
55 | | - for fileSetName, fileSet in design.FileSets.items(): |
56 | | - print(f" FileSet: {fileSetName}") |
57 | | - for file in fileSet.Files(): |
58 | | - print(f" {file.ResolvedPath}") |
| 52 | + |
| 53 | + self.assertEqual("StopWatch", project.Name) |
| 54 | + |
| 55 | + designs = [d for d in project.Designs.values()] |
| 56 | + self.assertEqual(1, len(designs)) |
| 57 | + |
| 58 | + design = designs[0] |
| 59 | + self.assertEqual("default", design.Name) |
| 60 | + self.assertIs(project.DefaultDesign, design) |
| 61 | + |
| 62 | + expectedFilsesetNames = ( |
| 63 | + "default", "src_Encoder", "src_Display", "src_StopWatch", "const_Encoder", "const_Display", "const_StopWatch", |
| 64 | + "sim_StopWatch", "utils_1" |
| 65 | + ) |
| 66 | + filesets = [fs for fs in design.FileSets.keys()] |
| 67 | + self.assertEqual(len(expectedFilsesetNames), len(filesets)) |
| 68 | + self.assertSequenceEqual(expectedFilsesetNames, filesets) |
| 69 | + |
| 70 | + # print(f"Project: {project.Name}") |
| 71 | + # for designName, design in project.Designs.items(): |
| 72 | + # print(f" Design: {designName}") |
| 73 | + # for fileSetName, fileSet in design.FileSets.items(): |
| 74 | + # print(f" FileSet: {fileSetName}") |
| 75 | + # for file in fileSet.Files(): |
| 76 | + # print(f" {file.ResolvedPath}") |
0 commit comments