@@ -4,17 +4,11 @@ import {decode as atob} from 'base-64';
4
4
5
5
import { Cheetah } from '@picovoice/cheetah-react-native' ;
6
6
7
+ const testData = require ( './test_data.json' ) ;
7
8
const platform = Platform . OS ;
8
9
9
10
const TEST_ACCESS_KEY : string = '{TESTING_ACCESS_KEY_HERE}' ;
10
11
11
- const LANGUAGE = 'en' ;
12
- const AUDIO_FILE = 'test.wav' ;
13
- const EXPECTED_TRANSCRIPT =
14
- 'Mr. Quilter is the apostle of the middle classes and we are glad to welcome his gospel.' ;
15
- const PUNCTUATIONS = [ '.' ] ;
16
- const ERROR_RATE = 0.025 ;
17
-
18
12
export type Result = {
19
13
testName : string ;
20
14
success : boolean ;
@@ -242,28 +236,34 @@ async function initTests(): Promise<Result[]> {
242
236
async function processTests ( ) : Promise < Result [ ] > {
243
237
const results : Result [ ] = [ ] ;
244
238
245
- let result = await runProcTestCase (
246
- LANGUAGE ,
247
- AUDIO_FILE ,
248
- EXPECTED_TRANSCRIPT ,
249
- PUNCTUATIONS ,
250
- ERROR_RATE ,
251
- ) ;
252
- logResult ( result ) ;
253
- results . push ( result ) ;
239
+ for ( const testParam of testData . tests . language_tests ) {
240
+ const result = await runProcTestCase (
241
+ testParam . language ,
242
+ testParam . audio_file ,
243
+ testParam . transcript ,
244
+ testParam . punctuations ,
245
+ testParam . error_rate ,
246
+ ) ;
247
+ result . testName = `Process test for '${ testParam . language } '` ;
248
+ logResult ( result ) ;
249
+ results . push ( result ) ;
250
+ }
254
251
255
- result = await runProcTestCase (
256
- LANGUAGE ,
257
- AUDIO_FILE ,
258
- EXPECTED_TRANSCRIPT ,
259
- PUNCTUATIONS ,
260
- ERROR_RATE ,
261
- {
262
- enablePunctuation : true ,
263
- } ,
264
- ) ;
265
- logResult ( result ) ;
266
- results . push ( result ) ;
252
+ for ( const testParam of testData . tests . language_tests ) {
253
+ const result = await runProcTestCase (
254
+ testParam . language ,
255
+ testParam . audio_file ,
256
+ testParam . transcript ,
257
+ testParam . punctuations ,
258
+ testParam . error_rate ,
259
+ {
260
+ enablePunctuation : true ,
261
+ } ,
262
+ ) ;
263
+ result . testName = `Process test with punctuation for '${ testParam . language } '` ;
264
+ logResult ( result ) ;
265
+ results . push ( result ) ;
266
+ }
267
267
268
268
return results ;
269
269
}
0 commit comments