def test_either(self) -> None: builder = EitherBuilder(Skip(), Skip()) assert_that( str(builder), is_( equal_to( dedent("""\ either skip; skip; end either;"""))), )
def test_if_else(self) -> None: builder = IfBuilder("foo", ).then(Skip(), ).else_(Skip(), ) assert_that( str(builder), is_( equal_to( dedent("""\ if foo then skip; else skip; end if;"""))), )
def test_with(self) -> None: builder = WithBuilder( "foo", ).do( Skip(), Skip(), ) assert_that( str(builder), is_(equal_to(dedent("""\ with foo do skip; skip; end with;"""))), )
def test_with_variables(self) -> None: builder = WithBuilder( VariableBuilder("foo"), VariableBuilder("bar").in_("baz"), ).do( Skip(), Skip(), ) assert_that( str(builder), is_(equal_to(dedent("""\ with foo, bar \\in baz do skip; skip; end with;"""))), )
def test_macro() -> None: builder = MacroBuilder("foo").args("bar", ).do(Skip(), ) assert_that( str(builder), is_( equal_to( dedent("""\ macro foo(bar) begin skip; end macro;"""))))
def test_while(self) -> None: builder = WhileBuilder("TRUE", ).do(Skip(), ) assert_that( str(builder), is_( equal_to( dedent("""\ while TRUE do skip; end while;"""))), )
def test_macros() -> None: builder = MacrosBuilder().define(MacroBuilder("foo").do(Skip()), ) assert_that( str(builder), is_( equal_to( dedent("""\ macro foo() begin skip; end macro;"""))))
def test_processes_builder(): builder = ProcessesBuilder().do( ProcessBuilder("foo", DeclType.EQUALS, "foo").do( Skip(), ), ProcessBuilder("bar", DeclType.EQUALS, "bar").do( Skip(), ), ) assert_that( str(builder), is_(equal_to(dedent("""\ process foo = foo begin skip; end process; process bar = bar begin skip; end process;"""))), )
def test_process_builder(): builder = ProcessBuilder("foo", DeclType.EQUALS, "bar").declare( VariableBuilder("baz"), ).do( Skip(), ) assert_that( str(builder), is_(equal_to(dedent("""\ process foo = bar variable baz; begin skip; end process;"""))), )
def test_procedures() -> None: builder = ProceduresBuilder().define( ProcedureBuilder("foo").do( Skip(), ), ) assert_that( str(builder), is_(equal_to(dedent("""\ procedure foo() begin skip; end procedure;"""))) )
def test_procedure() -> None: builder = ProcedureBuilder("foo").args( "bar", ).vars( PVariableBuilder("baz", "qox"), ).do( Skip(), ) assert_that( str(builder), is_(equal_to(dedent("""\ procedure foo(bar) variable baz = qox; begin skip; end procedure;"""))) )