"""Test VCD extensions."""

from hdltools.vcd.parser import BaseVCDParser


def test_parser():
    """Test VCD parser."""
    with open("tests/assets/example.vcd", "r") as vcdfile:
        vcd_data = vcdfile.read()

    vparser = BaseVCDParser()
    vparser.parse(vcd_data)


if __name__ == "__main__":
    test_parser()

@@ -21,16 +21,30 @@
 ns.%22%22%22%0A%0A
+import pytest%0A
 from hdl
@@ -81,16 +81,50 @@
 DParser%0A
+from hdltools.vcd import VCDScope%0A
 %0A%0Adef te
@@ -287,16 +287,16 @@
 arser()%0A
-
     vpar
@@ -316,16 +316,965 @@
 _data)%0A%0A
+def test_vcd_scope():%0A    %22%22%22Test VCDScope.%22%22%22%0A    scope = VCDScope(%22some%22, %22scopes%22, %22inside%22)%0A    similar_scope = VCDScope(%22some%22, %22scopes%22, %22inside%22)%0A    other_scope = VCDScope(%22some%22, %22other%22, %22scopes%22)%0A    contained_scope = VCDScope(%22some%22, %22scopes%22, %22inside%22, %22scopes%22)%0A%0A    assert (scope != other_scope)%0A    assert (scope == similar_scope)%0A    assert(repr(scope) == %22some::scopes::inside%22)%0A    assert(scope.contains(contained_scope))%0A    assert(not scope.contains(other_scope))%0A    assert(len(scope) == 3)%0A    assert(scope%5B0%5D == %22some%22)%0A%0A%0A    with pytest.raises(TypeError):%0A        scope == None%0A%0Adef test_vcd_scope_fromstr():%0A    %22%22%22Test building VCDScope from string.%22%22%22%0A%0A    scope, inclusive = VCDScope.from_str(%22VCD::Scope::example%22)%0A    assert(inclusive is False)%0A    scope, inclusive = VCDScope.from_str(%22VCD::Scope::example::%22)%0A    assert(inclusive is True)%0A%0A    with pytest.raises(TypeError):%0A        scope = VCDScope.from_str(123)%0A%0A%0A
 %0Aif __na

add tests for VCDScope class