package baidu

import (
	"fmt"
	"io/ioutil"
	"os"
	"testing"
)

func TestGetToken(t *testing.T) {
	AppID := "25050867"
	APIKey := "ctBGhGGm88Hudge0iBCSiF7y"
	SecretKey := "xyNcQfVtqxZMp20dqkDAyp6eGogfFbhV"
	sdk := NewAsrSdk(AppID, APIKey, SecretKey)
	sdk.GetToken()
}

func TestAsr(t *testing.T) {
	AppID := "25050867"
	APIKey := "ctBGhGGm88Hudge0iBCSiF7y"
	SecretKey := "xyNcQfVtqxZMp20dqkDAyp6eGogfFbhV"
	sdk := NewAsrSdk(AppID, APIKey, SecretKey)
	file, err := os.Open("./16k.wav")
	if err != nil {
		fmt.Println(err.Error())
		return
	}
	all, _ := ioutil.ReadAll(file)
	asr, err := sdk.Asr(all, "wav", 16000)
	fmt.Println(asr, err)
}
