File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed
Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change 1+ # copyright lowrisc contributors (opentitan project).
2+ # licensed under the apache license, version 2.0, see license for details.
3+ # spdx-license-identifier: apache-2.0
4+
5+ """Test the VCS tool plugin."""
6+
7+ from collections .abc import Sequence
8+
9+ from hamcrest import assert_that , equal_to
10+
11+ from dvsim .tool .utils import get_sim_tool_plugin
12+
13+ __all__ = ("TestVCSToolPlugin" ,)
14+
15+
16+ def fake_log (sim_time : int = 10 , sim_time_units : str = "units" ) -> Sequence [str ]:
17+ """Fabricate a log."""
18+ return [
19+ "Other" ,
20+ "log" ,
21+ "content" ,
22+ "" ,
23+ " V C S S i m u l a t i o n R e p o r t " ,
24+ f"Time: { sim_time } { sim_time_units } " ,
25+ ]
26+
27+
28+ class TestVCSToolPlugin :
29+ """Test the VCS tool plug-in."""
30+
31+ @staticmethod
32+ def test_get_simulated_time () -> None :
33+ """Test that sim plugins can be retrieved correctly."""
34+ plugin = get_sim_tool_plugin ("vcs" )
35+
36+ assert_that (
37+ plugin .get_simulated_time (
38+ log_text = fake_log (
39+ sim_time = 12345 ,
40+ sim_time_units = "squids" ,
41+ )
42+ ),
43+ equal_to ((12345 , "squids" )),
44+ )
You can’t perform that action at this time.
0 commit comments