-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
UI/UX improvements #53
Changes from 1 commit
e904515
06b6c73
abcb341
f43b9f0
f571a31
1599fb2
ecb827a
b17b599
2488d42
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,7 +47,9 @@ def main() -> None: | |
_exec_kast(program=args.program, backend=args.backend, output=args.output) | ||
elif args.command == 'test': | ||
wasm = Path(args.wasm.name) if args.wasm is not None else None | ||
_exec_test(wasm=wasm, id=args.id) | ||
if args.max_examples < 1: | ||
raise ValueError(f'--max-examples must be a positive integer (greater than 0), given {args.max_examples}') | ||
_exec_test(wasm=wasm, max_examples=args.max_examples, id=args.id) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a way to run unlimited examples? I think this option ends up getting sent to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hypothesis complains when it is less than 1:
|
||
elif args.command == 'prove': | ||
if args.prove_command is None or args.prove_command == 'run': | ||
wasm = Path(args.wasm.name) if args.wasm is not None else None | ||
|
@@ -77,7 +79,7 @@ def _exec_kast(*, program: Path, backend: Backend, output: KAstOutput | None) -> | |
_exit_with_output(proc_res) | ||
|
||
|
||
def _exec_test(*, wasm: Path | None, id: str | None) -> None: | ||
def _exec_test(*, wasm: Path | None, max_examples: int, id: str | None) -> None: | ||
"""Run a soroban test contract given its compiled wasm file. | ||
|
||
This will get the bindings for the contract and run all of the test functions. | ||
|
@@ -96,7 +98,7 @@ def _exec_test(*, wasm: Path | None, id: str | None) -> None: | |
child_wasms = _read_config_file(kasmer) | ||
wasm = kasmer.build_soroban_contract(Path.cwd()) | ||
|
||
kasmer.deploy_and_run(wasm, child_wasms, id=id) | ||
kasmer.deploy_and_run(wasm, child_wasms, max_examples, id) | ||
|
||
sys.exit(0) | ||
|
||
|
@@ -173,9 +175,14 @@ def _argument_parser() -> ArgumentParser: | |
kast_parser.add_argument('--output', metavar='FORMAT', type=KAstOutput, help='format to output the term in') | ||
|
||
test_parser = command_parser.add_parser('test', help='Test the soroban contract in the current working directory') | ||
test_parser.add_argument( | ||
'--max-examples', type=int, default=100, help='Maximum number of inputs for fuzzing (default: 100)' | ||
) | ||
_add_common_test_arguments(test_parser) | ||
|
||
prove_parser = command_parser.add_parser('prove', help='Prove the soroban contract in the current working directory') | ||
prove_parser = command_parser.add_parser( | ||
'prove', help='Prove the soroban contract in the current working directory' | ||
) | ||
prove_parser.add_argument( | ||
'prove_command', | ||
default='run', | ||
|
@@ -194,6 +201,7 @@ def _add_common_arguments(parser: ArgumentParser) -> None: | |
parser.add_argument('program', metavar='PROGRAM', type=file_path, help='path to test file') | ||
parser.add_argument('--backend', metavar='BACKEND', type=Backend, default=Backend.LLVM, help='K backend to use') | ||
|
||
|
||
def _add_common_test_arguments(parser: ArgumentParser) -> None: | ||
parser.add_argument('--id', help='Name of the test function in the testing contract') | ||
parser.add_argument('--wasm', type=FileType('r'), help='Use a specific contract wasm file instead') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please update the docstrings.