chore(cleanup): Remove temporary scripts after validation
This commit is contained in:
@@ -1,47 +0,0 @@
|
|||||||
import os
|
|
||||||
|
|
||||||
log_path = 'logs/20260325_103727/outputs/output_0013.txt'
|
|
||||||
with open(log_path, 'r', encoding='utf-8') as f:
|
|
||||||
content = f.read()
|
|
||||||
|
|
||||||
def extract(start_pat, end_pat, out_name):
|
|
||||||
start_marker = f'### `{start_pat}`'
|
|
||||||
end_marker = f'### `{end_pat}`'
|
|
||||||
|
|
||||||
start_pos = content.find(start_marker)
|
|
||||||
if start_pos == -1:
|
|
||||||
print(f"Start marker not found for {out_name}")
|
|
||||||
return
|
|
||||||
|
|
||||||
end_pos = content.find(end_marker, start_pos)
|
|
||||||
if end_pos == -1:
|
|
||||||
print(f"End marker not found for {out_name}")
|
|
||||||
return
|
|
||||||
|
|
||||||
block = content[start_pos:end_pos]
|
|
||||||
code_start = block.find('```cpp\r\n')
|
|
||||||
if code_start == -1:
|
|
||||||
code_start = block.find('```hpp\r\n')
|
|
||||||
if code_start == -1:
|
|
||||||
code_start = block.find('```cpp\n')
|
|
||||||
if code_start == -1:
|
|
||||||
code_start = block.find('```hpp\n')
|
|
||||||
|
|
||||||
if code_start == -1:
|
|
||||||
print(f"Code start marker not found for {out_name}")
|
|
||||||
return
|
|
||||||
|
|
||||||
code_start_offset = block.find('\n', code_start) + 1
|
|
||||||
code_end = block.rfind('```')
|
|
||||||
|
|
||||||
final_code = block[code_start_offset:code_end].strip()
|
|
||||||
|
|
||||||
out_path = os.path.join('tests/assets/gencpp_samples', out_name)
|
|
||||||
os.makedirs(os.path.dirname(out_path), exist_ok=True)
|
|
||||||
with open(out_path, 'w', encoding='utf-8', newline='\r\n') as f_out:
|
|
||||||
f_out.write(final_code)
|
|
||||||
print(f"Extracted {out_name}")
|
|
||||||
|
|
||||||
extract('C:/projects/gencpp/base/components/parser.cpp', 'C:/projects/gencpp/base/components/lexer.cpp', 'parser.cpp')
|
|
||||||
extract('C:/projects/gencpp/base/components/ast.hpp', 'C:/projects/gencpp/base/components/interface.parsing.cpp', 'ast.hpp')
|
|
||||||
extract('C:/projects/gencpp/base/components/types.hpp', 'C:/projects/gencpp/base/components/interface.hpp', 'types.hpp')
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
import os
|
|
||||||
|
|
||||||
def verify_files():
|
|
||||||
files = [
|
|
||||||
"base_component.h",
|
|
||||||
"component_registry.h",
|
|
||||||
"component_registry.cpp",
|
|
||||||
"complex_template.h"
|
|
||||||
]
|
|
||||||
base_path = "tests/assets/gencpp_samples"
|
|
||||||
for f in files:
|
|
||||||
p = os.path.join(base_path, f)
|
|
||||||
if os.path.exists(p):
|
|
||||||
print(f"Verified: {f}")
|
|
||||||
else:
|
|
||||||
print(f"Missing: {f}")
|
|
||||||
exit(1)
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
verify_files()
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
import sys
|
|
||||||
import os
|
|
||||||
sys.path.insert(0, os.getcwd())
|
|
||||||
|
|
||||||
from src.file_cache import ASTParser
|
|
||||||
|
|
||||||
def test_multibyte_definition_lookup():
|
|
||||||
# String with a multi-byte character (3 bytes)
|
|
||||||
# The shade character ▓ is 3 bytes in UTF-8.
|
|
||||||
# 3 shade characters = 9 bytes. In Python str they are 3 chars.
|
|
||||||
# Offset drift will be 6 bytes.
|
|
||||||
code = """
|
|
||||||
/* ▓▓▓ */
|
|
||||||
struct Target {
|
|
||||||
int x;
|
|
||||||
};
|
|
||||||
"""
|
|
||||||
parser = ASTParser("cpp")
|
|
||||||
# This should find Target and return its definition
|
|
||||||
definition = parser.get_definition(code, "Target")
|
|
||||||
print(f"Definition found: '{definition}'")
|
|
||||||
if "struct Target" not in definition:
|
|
||||||
print("FAILURE: 'struct Target' not in definition")
|
|
||||||
sys.exit(1)
|
|
||||||
if "int x;" not in definition:
|
|
||||||
print("FAILURE: 'int x;' not in definition")
|
|
||||||
sys.exit(1)
|
|
||||||
print("SUCCESS")
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
test_multibyte_definition_lookup()
|
|
||||||
Reference in New Issue
Block a user