Skip to content

Commit

Permalink
Minor fixes & Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
Rog3rSm1th committed Sep 17, 2024
1 parent 5d37cd1 commit edfeb9c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 10 deletions.
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,9 @@ When running the detectors we can generate test cases for each path in the funct


```
cargo run -- -f ./examples/sierra/fib_array.sierra -d
[...]
cargo run -- -f ./examples/sierra/symbolic_execution_test.sierra -d --detector-names tests
[Informational] Tests generator
[Testing] Tests generator
- symbolic::symbolic::symbolic_execution_test :
- v0: 102, v1: 0, v2: 0, v3: 0
- v0: 103, v1: 0, v2: 0, v3: 0
Expand Down
11 changes: 7 additions & 4 deletions bin/sierra-decompiler/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,13 @@ fn handle_detectors(decompiler: &mut Decompiler, detector_names: Vec<String>) {

// Run the specified detectors
for detector in detectors.iter_mut() {
// Skip TESTING detectors and detectors not in the provided names
if detector.detector_type() == DetectorType::TESTING
|| !detector_names.is_empty() && !detector_names.contains(&detector.id().to_string())
{
// Skip TESTING detectors if no specific detector names are provided
if detector_names.is_empty() && detector.detector_type() == DetectorType::TESTING {
continue;
}

// Skip detectors not in the provided names if names are provided
if !detector_names.is_empty() && !detector_names.contains(&detector.id().to_string()) {
continue;
}

Expand Down
3 changes: 3 additions & 0 deletions lib/src/detectors/functions_detector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ impl Detector for FunctionsDetector {
if index < total_functions - 1 {
result += "\n";
}

// Append the ANSI reset sequence
result += &"\x1b[0m".to_string();
}
}
result
Expand Down
4 changes: 2 additions & 2 deletions lib/tests/detectors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ fn test_functions_detector() {
// functions names
let functions_names = detector.detect(&mut decompiler);

let expected_output = r#"examples::fib_array::fib
examples::fib_array::fib_inner"#;
let expected_output =
"examples::fib_array::fib\n\u{1b}[0mexamples::fib_array::fib_inner\u{1b}[0m";

assert_eq!(functions_names, expected_output);
}
Expand Down

0 comments on commit edfeb9c

Please sign in to comment.