Skip to content

Commit

Permalink
Fixed test directory sturcture
Browse files Browse the repository at this point in the history
  • Loading branch information
AryazE committed Sep 30, 2024
1 parent caa0bc9 commit bb042fc
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 62 deletions.
10 changes: 3 additions & 7 deletions tests/manipulate_single_hook/decorator/analysis.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from dynapyt.analyses.BaseAnalysis import BaseAnalysis


class TestAnalysis(BaseAnalysis):
def begin_execution(self) -> None:
print("begin execution")
Expand All @@ -10,12 +9,9 @@ def enter_decorator(self, dyn_ast: str, iid: int, decorator: str, args, kwargs)

def exit_decorator(self, dyn_ast: str, iid: int, decorator: str, result, args, kwargs) -> None:
print("exit decorator: ", decorator)

def runtime_event(self, dyn_ast: str, iid: int) -> None:
print("runtime event")
number = 10
print("Number returned from exit_decorator: ", number)
return number

def control_flow_event(self, dyn_ast: str, iid: int) -> None:
print("control flow event")

def end_execution(self) -> None:
print("end execution")
36 changes: 3 additions & 33 deletions tests/manipulate_single_hook/decorator/expected.txt
Original file line number Diff line number Diff line change
@@ -1,39 +1,9 @@
begin execution
runtime event
control flow event
runtime event
runtime event
control flow event
runtime event
runtime event
control flow event
runtime event
control flow event
enter decorator: wrapper
runtime event
control flow event
runtime event
runtime event
control flow event
Decorator function before
runtime event
runtime event
control flow event
runtime event
control flow event
runtime event
runtime event
control flow event
Simple function
runtime event
control flow event
runtime event
runtime event
control flow event
Number returned from function: 2
Decorator function after
runtime event
control flow event
runtime event
control flow event
exit decorator: wrapper
Number returned from exit_decorator: 10
Number returned from decorated function: 10
end execution
10 changes: 7 additions & 3 deletions tests/manipulate_single_hook/decorator/program.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ def wrapper():
return wrapper

@decorator_function_one
def simple_function():
print("Simple function")
def return_number():
number = 2
print("Number returned from function: ", number)
return number

result = return_number()
print("Number returned from decorated function: ", result)

simple_function()

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from dynapyt.analyses.BaseAnalysis import BaseAnalysis


class TestAnalysis(BaseAnalysis):
def begin_execution(self) -> None:
print("begin execution")
Expand All @@ -9,9 +10,12 @@ def enter_decorator(self, dyn_ast: str, iid: int, decorator: str, args, kwargs)

def exit_decorator(self, dyn_ast: str, iid: int, decorator: str, result, args, kwargs) -> None:
print("exit decorator: ", decorator)
number = 10
print("Number returned from exit_decorator: ", number)
return number

def runtime_event(self, dyn_ast: str, iid: int) -> None:
print("runtime event")

def control_flow_event(self, dyn_ast: str, iid: int) -> None:
print("control flow event")

def end_execution(self) -> None:
print("end execution")
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
begin execution
runtime event
control flow event
runtime event
runtime event
control flow event
runtime event
runtime event
control flow event
runtime event
control flow event
enter decorator: wrapper
runtime event
control flow event
runtime event
runtime event
control flow event
Decorator function before
runtime event
runtime event
control flow event
runtime event
control flow event
runtime event
runtime event
control flow event
Simple function
runtime event
control flow event
runtime event
runtime event
control flow event
Decorator function after
runtime event
control flow event
runtime event
control flow event
exit decorator: wrapper
end execution
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,8 @@ def wrapper():
return wrapper

@decorator_function_one
def return_number():
number = 2
print("Number returned from function: ", number)
return number

result = return_number()
print("Number returned from decorated function: ", result)
def simple_function():
print("Simple function")

simple_function()

0 comments on commit bb042fc

Please sign in to comment.