Skip to content

Commit

Permalink
feat: added operation counter test case
Browse files Browse the repository at this point in the history
  • Loading branch information
micah-0w0 authored Jul 18, 2024
1 parent b114050 commit 0e5af8f
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/test_metrics.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from typing import override
from unittest import TestCase

from parser.parse import Parser
from utils.metrics import OpCounter


class TestCount(TestCase):
def test_counter(self) -> None:
p: Parser = Parser()
tree = p.parse(["!", "(", "A", "&", "!", "B", "|", "C", ")", "<EOF>"])
counter = OpCounter()

self.assertEqual(counter.getCount(), 0)

tree.accept(counter)

self.assertEqual(counter.getCount(), 4)

0 comments on commit 0e5af8f

Please sign in to comment.