helper/
lib.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Copyright 2020 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

use fuzz::fuzz;

pub fn add_bang(input: String) -> String {
    let mut result = input;
    result.push('!');
    result
}

pub fn toy_example(input: String) {
    let mut chars = input.chars();
    if chars.next() == Some('H') {
        if chars.next() == Some('I') {
            if chars.next() == Some('!') {
                panic!("it works!");
            }
        }
    }
}

// Compare with `toy_example_same_name` in ../src/lib.rs.
#[fuzz]
fn toy_example_same_name(input: String) {
    toy_example(input)
}