Skip to content

Commit

Permalink
C APIでも16通りテストする
Browse files Browse the repository at this point in the history
  • Loading branch information
qryxip committed Jan 4, 2024
1 parent 4444c69 commit bdb7c3b
Show file tree
Hide file tree
Showing 2 changed files with 206 additions and 14 deletions.
151 changes: 146 additions & 5 deletions crates/voicevox_core_c_api/tests/e2e/snapshots.toml
Original file line number Diff line number Diff line change
Expand Up @@ -84,21 +84,86 @@ result_messages.25 = "UUIDの変換に失敗しました"
result_messages.28 = "要求された機能を話者は持っていません"
stderr = ""

[morph.'{"text":"こんにちは、音声合成の世界へようこそ","base_style":1,"target_style":1}']
ok = true
[morph.'{"base_style":0,"target_style":0}']
ok = false
stderr.windows = '''
{windows-video-cards}
{timestamp} ERROR voicevox_core::helpers: `dummy1` (574bc678-8370-44be-b941-08e46e7b47d7)は以下の機能を持ちません: `dummy1` (574bc678-8370-44be-b941-08e46e7b47d7)に対するモーフィング
{timestamp} ERROR voicevox_core::helpers: Caused by: `dummy1` (574bc678-8370-44be-b941-08e46e7b47d7)は以下の機能を持ちません: `dummy1` (574bc678-8370-44be-b941-08e46e7b47d7)に対するモーフィング
'''
stderr.unix = '''
{timestamp} ERROR voicevox_core::helpers: `dummy1` (574bc678-8370-44be-b941-08e46e7b47d7)は以下の機能を持ちません: `dummy1` (574bc678-8370-44be-b941-08e46e7b47d7)に対するモーフィング
{timestamp} ERROR voicevox_core::helpers: Caused by: `dummy1` (574bc678-8370-44be-b941-08e46e7b47d7)は以下の機能を持ちません: `dummy1` (574bc678-8370-44be-b941-08e46e7b47d7)に対するモーフィング
'''

[morph.'{"base_style":0,"target_style":1}']
ok = false
stderr.windows = '''
{windows-video-cards}
{timestamp} ERROR voicevox_core::helpers: `dummy1` (574bc678-8370-44be-b941-08e46e7b47d7)は以下の機能を持ちません: `dummy2` (dd9ccd75-75f6-40ce-a3db-960cbed2e905)に対するモーフィング
{timestamp} ERROR voicevox_core::helpers: Caused by: `dummy1` (574bc678-8370-44be-b941-08e46e7b47d7)は以下の機能を持ちません: `dummy2` (dd9ccd75-75f6-40ce-a3db-960cbed2e905)に対するモーフィング
'''
stderr.unix = '''
{timestamp} ERROR voicevox_core::helpers: `dummy1` (574bc678-8370-44be-b941-08e46e7b47d7)は以下の機能を持ちません: `dummy2` (dd9ccd75-75f6-40ce-a3db-960cbed2e905)に対するモーフィング
{timestamp} ERROR voicevox_core::helpers: Caused by: `dummy1` (574bc678-8370-44be-b941-08e46e7b47d7)は以下の機能を持ちません: `dummy2` (dd9ccd75-75f6-40ce-a3db-960cbed2e905)に対するモーフィング
'''

[morph.'{"base_style":0,"target_style":302}']
ok = false
stderr.windows = '''
{windows-video-cards}
{timestamp} ERROR voicevox_core::helpers: `dummy1` (574bc678-8370-44be-b941-08e46e7b47d7)は以下の機能を持ちません: `dummy3` (5d3d9aa9-88e5-4a96-8ef7-f13a3cad1cb3)に対するモーフィング
{timestamp} ERROR voicevox_core::helpers: Caused by: `dummy1` (574bc678-8370-44be-b941-08e46e7b47d7)は以下の機能を持ちません: `dummy3` (5d3d9aa9-88e5-4a96-8ef7-f13a3cad1cb3)に対するモーフィング
'''
stderr.unix = '''
{timestamp} ERROR voicevox_core::helpers: `dummy1` (574bc678-8370-44be-b941-08e46e7b47d7)は以下の機能を持ちません: `dummy3` (5d3d9aa9-88e5-4a96-8ef7-f13a3cad1cb3)に対するモーフィング
{timestamp} ERROR voicevox_core::helpers: Caused by: `dummy1` (574bc678-8370-44be-b941-08e46e7b47d7)は以下の機能を持ちません: `dummy3` (5d3d9aa9-88e5-4a96-8ef7-f13a3cad1cb3)に対するモーフィング
'''

[morph.'{"base_style":0,"target_style":303}']
ok = false
stderr.windows = '''
{windows-video-cards}
{timestamp} ERROR voicevox_core::helpers: `dummy1` (574bc678-8370-44be-b941-08e46e7b47d7)は以下の機能を持ちません: `dummy3` (5d3d9aa9-88e5-4a96-8ef7-f13a3cad1cb3)に対するモーフィング
{timestamp} ERROR voicevox_core::helpers: Caused by: `dummy1` (574bc678-8370-44be-b941-08e46e7b47d7)は以下の機能を持ちません: `dummy3` (5d3d9aa9-88e5-4a96-8ef7-f13a3cad1cb3)に対するモーフィング
'''
stderr.unix = '''
{timestamp} ERROR voicevox_core::helpers: `dummy1` (574bc678-8370-44be-b941-08e46e7b47d7)は以下の機能を持ちません: `dummy3` (5d3d9aa9-88e5-4a96-8ef7-f13a3cad1cb3)に対するモーフィング
{timestamp} ERROR voicevox_core::helpers: Caused by: `dummy1` (574bc678-8370-44be-b941-08e46e7b47d7)は以下の機能を持ちません: `dummy3` (5d3d9aa9-88e5-4a96-8ef7-f13a3cad1cb3)に対するモーフィング
'''

[morph.'{"base_style":1,"target_style":0}']
ok = false
stderr.windows = '''
{windows-video-cards}
{timestamp} ERROR voicevox_core::helpers: `dummy2` (dd9ccd75-75f6-40ce-a3db-960cbed2e905)は以下の機能を持ちません: `dummy1` (574bc678-8370-44be-b941-08e46e7b47d7)に対するモーフィング
{timestamp} ERROR voicevox_core::helpers: Caused by: `dummy2` (dd9ccd75-75f6-40ce-a3db-960cbed2e905)は以下の機能を持ちません: `dummy1` (574bc678-8370-44be-b941-08e46e7b47d7)に対するモーフィング
'''
stderr.unix = '''
{timestamp} ERROR voicevox_core::helpers: `dummy2` (dd9ccd75-75f6-40ce-a3db-960cbed2e905)は以下の機能を持ちません: `dummy1` (574bc678-8370-44be-b941-08e46e7b47d7)に対するモーフィング
{timestamp} ERROR voicevox_core::helpers: Caused by: `dummy2` (dd9ccd75-75f6-40ce-a3db-960cbed2e905)は以下の機能を持ちません: `dummy1` (574bc678-8370-44be-b941-08e46e7b47d7)に対するモーフィング
'''
stderr.unix = ""

[morph.'{"text":"こんにちは、音声合成の世界へようこそ","base_style":302,"target_style":303}']
[morph.'{"base_style":1,"target_style":1}']
ok = true
stderr.windows = '''
{windows-video-cards}
'''
stderr.unix = ""

[morph.'{"text":"こんにちは、音声合成の世界へようこそ","base_style":1,"target_style":302}']
[morph.'{"base_style":1,"target_style":302}']
ok = false
stderr.windows = '''
{windows-video-cards}
{timestamp} ERROR voicevox_core::helpers: `dummy2` (dd9ccd75-75f6-40ce-a3db-960cbed2e905)は以下の機能を持ちません: `dummy3` (5d3d9aa9-88e5-4a96-8ef7-f13a3cad1cb3)に対するモーフィング
{timestamp} ERROR voicevox_core::helpers: Caused by: `dummy2` (dd9ccd75-75f6-40ce-a3db-960cbed2e905)は以下の機能を持ちません: `dummy3` (5d3d9aa9-88e5-4a96-8ef7-f13a3cad1cb3)に対するモーフィング
'''
stderr.unix = '''
{timestamp} ERROR voicevox_core::helpers: `dummy2` (dd9ccd75-75f6-40ce-a3db-960cbed2e905)は以下の機能を持ちません: `dummy3` (5d3d9aa9-88e5-4a96-8ef7-f13a3cad1cb3)に対するモーフィング
{timestamp} ERROR voicevox_core::helpers: Caused by: `dummy2` (dd9ccd75-75f6-40ce-a3db-960cbed2e905)は以下の機能を持ちません: `dummy3` (5d3d9aa9-88e5-4a96-8ef7-f13a3cad1cb3)に対するモーフィング
'''

[morph.'{"base_style":1,"target_style":303}']
ok = false
stderr.windows = '''
{windows-video-cards}
Expand All @@ -110,6 +175,82 @@ stderr.unix = '''
{timestamp} ERROR voicevox_core::helpers: Caused by: `dummy2` (dd9ccd75-75f6-40ce-a3db-960cbed2e905)は以下の機能を持ちません: `dummy3` (5d3d9aa9-88e5-4a96-8ef7-f13a3cad1cb3)に対するモーフィング
'''

[morph.'{"base_style":302,"target_style":0}']
ok = false
stderr.windows = '''
{windows-video-cards}
{timestamp} ERROR voicevox_core::helpers: `dummy3` (5d3d9aa9-88e5-4a96-8ef7-f13a3cad1cb3)は以下の機能を持ちません: `dummy1` (574bc678-8370-44be-b941-08e46e7b47d7)に対するモーフィング
{timestamp} ERROR voicevox_core::helpers: Caused by: `dummy3` (5d3d9aa9-88e5-4a96-8ef7-f13a3cad1cb3)は以下の機能を持ちません: `dummy1` (574bc678-8370-44be-b941-08e46e7b47d7)に対するモーフィング
'''
stderr.unix = '''
{timestamp} ERROR voicevox_core::helpers: `dummy3` (5d3d9aa9-88e5-4a96-8ef7-f13a3cad1cb3)は以下の機能を持ちません: `dummy1` (574bc678-8370-44be-b941-08e46e7b47d7)に対するモーフィング
{timestamp} ERROR voicevox_core::helpers: Caused by: `dummy3` (5d3d9aa9-88e5-4a96-8ef7-f13a3cad1cb3)は以下の機能を持ちません: `dummy1` (574bc678-8370-44be-b941-08e46e7b47d7)に対するモーフィング
'''

[morph.'{"base_style":302,"target_style":1}']
ok = false
stderr.windows = '''
{windows-video-cards}
{timestamp} ERROR voicevox_core::helpers: `dummy3` (5d3d9aa9-88e5-4a96-8ef7-f13a3cad1cb3)は以下の機能を持ちません: `dummy2` (dd9ccd75-75f6-40ce-a3db-960cbed2e905)に対するモーフィング
{timestamp} ERROR voicevox_core::helpers: Caused by: `dummy3` (5d3d9aa9-88e5-4a96-8ef7-f13a3cad1cb3)は以下の機能を持ちません: `dummy2` (dd9ccd75-75f6-40ce-a3db-960cbed2e905)に対するモーフィング
'''
stderr.unix = '''
{timestamp} ERROR voicevox_core::helpers: `dummy3` (5d3d9aa9-88e5-4a96-8ef7-f13a3cad1cb3)は以下の機能を持ちません: `dummy2` (dd9ccd75-75f6-40ce-a3db-960cbed2e905)に対するモーフィング
{timestamp} ERROR voicevox_core::helpers: Caused by: `dummy3` (5d3d9aa9-88e5-4a96-8ef7-f13a3cad1cb3)は以下の機能を持ちません: `dummy2` (dd9ccd75-75f6-40ce-a3db-960cbed2e905)に対するモーフィング
'''

[morph.'{"base_style":302,"target_style":302}']
ok = true
stderr.windows = '''
{windows-video-cards}
'''
stderr.unix = ""

[morph.'{"base_style":302,"target_style":303}']
ok = true
stderr.windows = '''
{windows-video-cards}
'''
stderr.unix = ""

[morph.'{"base_style":303,"target_style":0}']
ok = false
stderr.windows = '''
{windows-video-cards}
{timestamp} ERROR voicevox_core::helpers: `dummy3` (5d3d9aa9-88e5-4a96-8ef7-f13a3cad1cb3)は以下の機能を持ちません: `dummy1` (574bc678-8370-44be-b941-08e46e7b47d7)に対するモーフィング
{timestamp} ERROR voicevox_core::helpers: Caused by: `dummy3` (5d3d9aa9-88e5-4a96-8ef7-f13a3cad1cb3)は以下の機能を持ちません: `dummy1` (574bc678-8370-44be-b941-08e46e7b47d7)に対するモーフィング
'''
stderr.unix = '''
{timestamp} ERROR voicevox_core::helpers: `dummy3` (5d3d9aa9-88e5-4a96-8ef7-f13a3cad1cb3)は以下の機能を持ちません: `dummy1` (574bc678-8370-44be-b941-08e46e7b47d7)に対するモーフィング
{timestamp} ERROR voicevox_core::helpers: Caused by: `dummy3` (5d3d9aa9-88e5-4a96-8ef7-f13a3cad1cb3)は以下の機能を持ちません: `dummy1` (574bc678-8370-44be-b941-08e46e7b47d7)に対するモーフィング
'''

[morph.'{"base_style":303,"target_style":1}']
ok = false
stderr.windows = '''
{windows-video-cards}
{timestamp} ERROR voicevox_core::helpers: `dummy3` (5d3d9aa9-88e5-4a96-8ef7-f13a3cad1cb3)は以下の機能を持ちません: `dummy2` (dd9ccd75-75f6-40ce-a3db-960cbed2e905)に対するモーフィング
{timestamp} ERROR voicevox_core::helpers: Caused by: `dummy3` (5d3d9aa9-88e5-4a96-8ef7-f13a3cad1cb3)は以下の機能を持ちません: `dummy2` (dd9ccd75-75f6-40ce-a3db-960cbed2e905)に対するモーフィング
'''
stderr.unix = '''
{timestamp} ERROR voicevox_core::helpers: `dummy3` (5d3d9aa9-88e5-4a96-8ef7-f13a3cad1cb3)は以下の機能を持ちません: `dummy2` (dd9ccd75-75f6-40ce-a3db-960cbed2e905)に対するモーフィング
{timestamp} ERROR voicevox_core::helpers: Caused by: `dummy3` (5d3d9aa9-88e5-4a96-8ef7-f13a3cad1cb3)は以下の機能を持ちません: `dummy2` (dd9ccd75-75f6-40ce-a3db-960cbed2e905)に対するモーフィング
'''

[morph.'{"base_style":303,"target_style":302}']
ok = true
stderr.windows = '''
{windows-video-cards}
'''
stderr.unix = ""

[morph.'{"base_style":303,"target_style":303}']
ok = true
stderr.windows = '''
{windows-video-cards}
'''
stderr.unix = ""

[simple_tts]
output."こんにちは、音声合成の世界へようこそ".wav_length = 176172
stderr.windows = '''
Expand Down
69 changes: 60 additions & 9 deletions crates/voicevox_core_c_api/tests/e2e/testcases/morph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,79 @@ use crate::{
},
};

const TEXT: &CStr = cstr!("こんにちは、音声合成の世界へようこそ");
const MORPH_RATE: f64 = 0.5;

case!(TestCase {
base_style: 0,
target_style: 0,
});
case!(TestCase {
base_style: 0,
target_style: 1,
});
case!(TestCase {
base_style: 0,
target_style: 302,
});
case!(TestCase {
base_style: 0,
target_style: 303,
});

case!(TestCase {
base_style: 1,
target_style: 0,
});
case!(TestCase {
text: "こんにちは、音声合成の世界へようこそ".to_owned(),
base_style: 1,
target_style: 1,
});
case!(TestCase {
text: "こんにちは、音声合成の世界へようこそ".to_owned(),
base_style: 1,
target_style: 302,
});
case!(TestCase {
base_style: 1,
target_style: 303,
});

case!(TestCase {
base_style: 302,
target_style: 0,
});
case!(TestCase {
base_style: 302,
target_style: 1,
});
case!(TestCase {
base_style: 302,
target_style: 302,
});
case!(TestCase {
base_style: 302,
target_style: 303,
});

case!(TestCase {
text: "こんにちは、音声合成の世界へようこそ".to_owned(),
base_style: 1,
base_style: 303,
target_style: 0,
});
case!(TestCase {
base_style: 303,
target_style: 1,
});
case!(TestCase {
base_style: 303,
target_style: 302,
});
case!(TestCase {
base_style: 303,
target_style: 303,
});

#[derive(Serialize, Deserialize)]
struct TestCase {
text: String,
base_style: VoicevoxStyleId,
target_style: VoicevoxStyleId,
}
Expand Down Expand Up @@ -107,10 +161,9 @@ impl assert_cdylib::TestCase for TestCase {

let audio_query = {
let mut audio_query = MaybeUninit::uninit();
let text = CString::new(&*self.text).unwrap();
assert_ok(voicevox_synthesizer_create_audio_query(
synthesizer,
text.as_ptr(),
TEXT.as_ptr(),
self.base_style,
audio_query.as_mut_ptr(),
));
Expand All @@ -134,8 +187,6 @@ impl assert_cdylib::TestCase for TestCase {

// TODO: スナップショットテストをやる
let result = {
const MORPH_RATE: f64 = 0.5;

let mut wav_length = MaybeUninit::uninit();
let mut wav = MaybeUninit::uninit();
let result = voicevox_synthesizer_synthesis_morphing(
Expand Down

0 comments on commit bdb7c3b

Please sign in to comment.