Skip to content

Commit

Permalink
v0.2 ios
Browse files Browse the repository at this point in the history
  • Loading branch information
ksyeo1010 committed Nov 3, 2023
1 parent d2e8c5f commit 5f2d4e5
Show file tree
Hide file tree
Showing 6 changed files with 104 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,4 +123,84 @@ class EagleAppTestUITests: BaseTest {
XCTAssertLessThan(scores.max()!, 0.5)
eagle.delete()
}

func testMessageStack() throws {
let enrollUrls = enrollUrls()

let eagleProfiler = try EagleProfiler(accessKey: accessKey)
for url in enrollUrls {
let pcm = try readPcmFromFile(testAudioURL: url)
(_, _) = try eagleProfiler.enroll(pcm: pcm)
}

let profile = try eagleProfiler.export()
eagleProfiler.delete()

var first_error: String = ""
do {
let eagle = try Eagle(accessKey: "invalid", speakerProfiles: [profile])
XCTAssertNil(eagle)
} catch {
first_error = "\(error.localizedDescription)"
XCTAssert(first_error.count < 1024)
}

do {
let eagle = try Eagle(accessKey: "invalid", speakerProfiles: [profile])
XCTAssertNil(eagle)
} catch {
XCTAssert("\(error.localizedDescription)".count == first_error.count)
}
}

func testEnrollExportMessageStack() throws {
let e = try EagleProfiler.init(accessKey: accessKey)
e.delete()

var testPcm: [Int16] = []
testPcm.reserveCapacity(Int(Eagle.frameLength))

do {
let (res, _) = try e.enroll(pcm: testPcm)
XCTAssert(res == -1)
} catch {
XCTAssert("\(error.localizedDescription)".count > 0)
XCTAssert("\(error.localizedDescription)".count < 8)
}

do {
let res = try e.export()
XCTAssertNil(res)
} catch {
XCTAssert("\(error.localizedDescription)".count > 0)
XCTAssert("\(error.localizedDescription)".count < 8)
}
}

func testProcessMessageStack() throws {
let enrollUrls = enrollUrls()

let eagleProfiler = try EagleProfiler(accessKey: accessKey)
for url in enrollUrls {
let pcm = try readPcmFromFile(testAudioURL: url)
(_, _) = try eagleProfiler.enroll(pcm: pcm)
}

let profile = try eagleProfiler.export()
eagleProfiler.delete()

let e = try Eagle.init(accessKey: accessKey, speakerProfiles: [profile])
e.delete()

var testPcm: [Int16] = []
testPcm.reserveCapacity(Int(Eagle.frameLength))

do {
let res = try e.process(pcm: testPcm)
XCTAssert(res.count == -1)
} catch {
XCTAssert("\(error.localizedDescription)".count > 0)
XCTAssert("\(error.localizedDescription)".count < 8)
}
}
}
8 changes: 4 additions & 4 deletions binding/ios/EagleAppTest/Podfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
source 'https://cdn.cocoapods.org/'
platform :ios, '11.0'
platform :ios, '13.0'

target 'EagleAppTest' do
pod 'Eagle-iOS', '~> 0.1.0'
pod 'Eagle-iOS', :podspec => 'https://raw.githubusercontent.com/Picovoice/eagle/v0.2-ios/binding/ios/Eagle-iOS.podspec'
end

target 'EagleAppTestUITests' do
pod 'Eagle-iOS', '~> 0.1.0'
pod 'Eagle-iOS', :podspec => 'https://raw.githubusercontent.com/Picovoice/eagle/v0.2-ios/binding/ios/Eagle-iOS.podspec'
end

target 'PerformanceTest' do
pod 'Eagle-iOS', '~> 0.1.0'
pod 'Eagle-iOS', :podspec => 'https://raw.githubusercontent.com/Picovoice/eagle/v0.2-ios/binding/ios/Eagle-iOS.podspec'
end
16 changes: 8 additions & 8 deletions binding/ios/EagleAppTest/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
PODS:
- Eagle-iOS (0.1.0)
- Eagle-iOS (0.2.0)

DEPENDENCIES:
- Eagle-iOS (~> 0.1.0)
- Eagle-iOS (from `https://raw.githubusercontent.com/Picovoice/eagle/v0.2-ios/binding/ios/Eagle-iOS.podspec`)

SPEC REPOS:
trunk:
- Eagle-iOS
EXTERNAL SOURCES:
Eagle-iOS:
:podspec: https://raw.githubusercontent.com/Picovoice/eagle/v0.2-ios/binding/ios/Eagle-iOS.podspec

SPEC CHECKSUMS:
Eagle-iOS: 2d510466a68b22ba137dd2b39086268c4130c321
Eagle-iOS: 155eb54e73e37533a0accf3ea5fa1a37d8c999ad

PODFILE CHECKSUM: a3a1c94c7c11252c2152ed23f2cead73c1cf3762
PODFILE CHECKSUM: 6ecb4b66367607455bddf4dcad4ec1f8c70935a7

COCOAPODS: 1.12.1
COCOAPODS: 1.11.3
4 changes: 2 additions & 2 deletions demo/ios/EagleDemo/EagleDemo/ViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class ViewModel: ObservableObject {

try createDumpFile(filename: "enroll_dump.pcm")
} catch let error as EagleInvalidArgumentError {
errorMessage = "\(error.localizedDescription)\nEnsure your accessKey '\(accessKey)' is valid"
errorMessage = "\(error.localizedDescription)"
} catch is EagleActivationError {
errorMessage = "AccessKey activation error"
} catch is EagleActivationRefusedError {
Expand Down Expand Up @@ -162,7 +162,7 @@ class ViewModel: ObservableObject {

try createDumpFile(filename: "test_dump.pcm")
} catch let error as EagleInvalidArgumentError {
errorMessage = "\(error.localizedDescription)\nEnsure your accessKey '\(accessKey)' is valid"
errorMessage = "\(error.localizedDescription)"
} catch is EagleActivationError {
errorMessage = "AccessKey activation error"
} catch is EagleActivationRefusedError {
Expand Down
2 changes: 1 addition & 1 deletion demo/ios/EagleDemo/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ source 'https://cdn.cocoapods.org/'
platform :ios, '14.0'

target 'EagleDemo' do
pod 'Eagle-iOS', '~> 0.1.0'
pod 'Eagle-iOS', :podspec => 'https://raw.githubusercontent.com/Picovoice/eagle/v0.2-ios/binding/ios/Eagle-iOS.podspec'
pod 'ios-voice-processor', '~> 1.0.3'
end
15 changes: 9 additions & 6 deletions demo/ios/EagleDemo/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
PODS:
- Eagle-iOS (0.1.0)
- Eagle-iOS (0.2.0)
- ios-voice-processor (1.0.3)

DEPENDENCIES:
- Eagle-iOS (~> 0.1.0)
- Eagle-iOS (from `https://raw.githubusercontent.com/Picovoice/eagle/v0.2-ios/binding/ios/Eagle-iOS.podspec`)
- ios-voice-processor (~> 1.0.3)

SPEC REPOS:
trunk:
- Eagle-iOS
- ios-voice-processor

EXTERNAL SOURCES:
Eagle-iOS:
:podspec: https://raw.githubusercontent.com/Picovoice/eagle/v0.2-ios/binding/ios/Eagle-iOS.podspec

SPEC CHECKSUMS:
Eagle-iOS: 2d510466a68b22ba137dd2b39086268c4130c321
Eagle-iOS: 155eb54e73e37533a0accf3ea5fa1a37d8c999ad
ios-voice-processor: 65b25a8db69ea25ffba0eeef37bae71a982f34cc

PODFILE CHECKSUM: bd16b739f521d3070da2020a2446d0cabb973dd0
PODFILE CHECKSUM: 04795797e862a461d1bfc97cddf986962ba2c8c2

COCOAPODS: 1.12.1
COCOAPODS: 1.11.3

0 comments on commit 5f2d4e5

Please sign in to comment.