Skip to content

Commit

Permalink
test: Add new options to fuzzer
Browse files Browse the repository at this point in the history
  • Loading branch information
kanru committed Jul 25, 2024
1 parent 243cd5b commit 7c8347b
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
8 changes: 8 additions & 0 deletions capi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -988,6 +988,14 @@ pub mod globals {
/// Returns whether the automatic learning is enabled or disabled.
pub use super::io::chewing_get_autoLearn;

pub use super::io::chewing_config_has_option;

pub use super::io::chewing_config_get_int;
pub use super::io::chewing_config_set_int;

pub use super::io::chewing_config_get_str;
pub use super::io::chewing_config_set_str;

pub use super::public::MAX_CHI_SYMBOL_LEN;
pub use super::public::MIN_CHI_SYMBOL_LEN;

Expand Down
25 changes: 22 additions & 3 deletions fuzzer/src/bin/fuzzer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ use chewing_capi::{
chewing_cand_TotalPage, chewing_cand_hasNext, chewing_set_candPerPage,
},
globals::{
chewing_set_addPhraseDirection, chewing_set_autoLearn, chewing_set_autoShiftCur,
chewing_set_easySymbolInput, chewing_set_escCleanAllBuf, chewing_set_maxChiSymbolLen,
chewing_set_phraseChoiceRearward, chewing_set_spaceAsSelection,
chewing_config_set_int, chewing_set_addPhraseDirection, chewing_set_autoLearn,
chewing_set_autoShiftCur, chewing_set_easySymbolInput, chewing_set_escCleanAllBuf,
chewing_set_maxChiSymbolLen, chewing_set_phraseChoiceRearward,
chewing_set_spaceAsSelection,
},
input::*,
layout::chewing_set_KBType,
Expand Down Expand Up @@ -186,6 +187,24 @@ pub fn main() -> Result<()> {
.clamp(0, 1)
.into(),
);
chewing_config_set_int(
ctx,
c"chewing.enable_fullwidth_toggle_key".as_ptr(),
ops.next()
.transpose()?
.unwrap_or_default()
.clamp(0, 1)
.into(),
);
chewing_config_set_int(
ctx,
c"chewing.conversion_engine".as_ptr(),
ops.next()
.transpose()?
.unwrap_or_default()
.clamp(0, 2)
.into(),
);

while let Some(Ok(op)) = ops.next() {
use ChewingHandle::*;
Expand Down

0 comments on commit 7c8347b

Please sign in to comment.