MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / normalize_base32

Function normalize_base32

atomic-cli/tests/it/import_budget_100k_bench.rs:511–534  ·  view source on GitHub ↗

Replace base32-looking runs of >= 32 chars with ` ` (mirrors the CB-13D harness normalization: per-repository change identities are not state shapes).

(text: &str)

Source from the content-addressed store, hash-verified

509/// CB-13D harness normalization: per-repository change identities are not
510/// state shapes).
511fn normalize_base32(text: &str) -> String {
512 let mut normalized = String::with_capacity(text.len());
513 let mut run = String::new();
514 for character in text.chars() {
515 let matches = character.is_ascii_uppercase() || ('2'..='7').contains(&character);
516 if matches {
517 run.push(character);
518 } else {
519 if run.len() >= 32 {
520 normalized.push_str("<state>");
521 } else {
522 normalized.push_str(&run);
523 }
524 run.clear();
525 normalized.push(character);
526 }
527 }
528 if run.len() >= 32 {
529 normalized.push_str("<state>");
530 } else {
531 normalized.push_str(&run);
532 }
533 normalized
534}
535
536/// AC-3 measurement: watcher-off equivalence through the real CLI.
537///

Callers

nothing calls this directly

Calls 4

clearMethod · 0.65
lenMethod · 0.45
containsMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected