From a5c2e01af29f8e32d6d3d6d0f054922be1918e86 Mon Sep 17 00:00:00 2001 From: Kwangsoo Yeo Date: Wed, 1 Nov 2023 16:09:47 -0700 Subject: [PATCH] update tests --- binding/go/porcupine_test.go | 19 +++++-------------- .../PorcupineAppTestUITests.swift | 15 +++++++++++++++ 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/binding/go/porcupine_test.go b/binding/go/porcupine_test.go index 65aa55cee..c9b5877f1 100644 --- a/binding/go/porcupine_test.go +++ b/binding/go/porcupine_test.go @@ -326,19 +326,10 @@ func TestProcessMessageStack(t *testing.T) { porcupine.handle = nil testPcm := make([]int16, FrameLength) - ret, _ := nativePorcupine.nativeProcess(&porcupine, testPcm) - if ret != SUCCESS { - errorStatus, messageStack := nativePorcupine.nativeGetErrorStack() - if errorStatus != SUCCESS { - t.Fatalf("Unable to get Porcupine error state") - } - - if len(messageStack) == 0 || len(messageStack) > 8 { - t.Fatalf("Invalid message stack length %d", len(messageStack)) - } - } else { - t.Fatalf("Expected process to fail") - } - + + _, err = porcupine.Process(testPcm) porcupine.handle = address + if err == nil { + t.Fatalf("Expected porcupine process to fail") + } } diff --git a/binding/ios/PorcupineAppTest/PorcupineAppTestUITests/PorcupineAppTestUITests.swift b/binding/ios/PorcupineAppTest/PorcupineAppTestUITests/PorcupineAppTestUITests.swift index 9a9a9e695..5caae7f86 100644 --- a/binding/ios/PorcupineAppTest/PorcupineAppTestUITests/PorcupineAppTestUITests.swift +++ b/binding/ios/PorcupineAppTest/PorcupineAppTestUITests/PorcupineAppTestUITests.swift @@ -263,4 +263,19 @@ class PorcupineAppTestUITests: BaseTest { XCTAssert("\(error.localizedDescription)".count == first_error.count) } } + + func testProcessMessageStack() throws { + let p = try Porcupine.init(accessKey: accessKey, keyword: Porcupine.BuiltInKeyword.porcupine) + p.delete() + + var testPcm: [Int16] = [] + testPcm.reserveCapacity(p.frameLength) + + do { + let res = p.process(testPcm) + XCTAssert(res == 100) + } catch { + XCTAssert("\(error.localizedDescription)".count > 0) + } + } }