Skip to content
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

test: Add new options to fuzzer #631

Merged
merged 1 commit into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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