Skip to content

Commit

Permalink
[Rust]internalのfinalizeを実装した (VOICEVOX#160)
Browse files Browse the repository at this point in the history
finalizeを実装した
  • Loading branch information
qwerty2501 committed Jul 23, 2022
1 parent 960c536 commit b50d3fa
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion crates/voicevox_core/src/internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ impl Internal {
}
}
pub fn finalize(&mut self) {
unimplemented!()
self.initialized = false;
self.status_option = None;
}
pub fn metas(&self) -> &'static CStr {
&METAS_CSTRING
Expand Down Expand Up @@ -363,6 +364,16 @@ mod tests {
use super::*;
use pretty_assertions::assert_eq;

#[rstest]
fn finalize_works() {
let internal = Internal::new_with_mutex();
let result = internal.lock().unwrap().initialize(false, 0, false);
assert_eq!(Ok(()), result);
internal.lock().unwrap().finalize();
assert_eq!(false, internal.lock().unwrap().initialized);
assert_eq!(true, internal.lock().unwrap().status_option.is_none());
}

#[rstest]
#[case(0, Err(Error::UninitializedStatus), Ok(()))]
#[case(1, Err(Error::UninitializedStatus), Ok(()))]
Expand Down

0 comments on commit b50d3fa

Please sign in to comment.