Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ksyeo1010 committed Nov 1, 2023
1 parent a5c2e01 commit 7f5a218
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 10 deletions.
4 changes: 2 additions & 2 deletions binding/dotnet/PorcupineTest/MainTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -338,14 +338,14 @@ public void TestMessageStack()
public void TestProcessMessageStack()
{
List<BuiltInKeyword> keywords = new List<Pv.BuiltInKeyword>() { BuiltInKeyword.PORCUPINE };
Porcupine p = Porcupine.FromBuiltInKeywords(
Porcupine p = Porcupine.FromBuiltInKeywords(
_accessKey,
keywords,
GetModelPath("en"));
short[] testPcm = new short[p.FrameLength];

var obj = typeof(Porcupine).GetField("_libraryPointer", BindingFlags.NonPublic | BindingFlags.Instance);
IntPtr address = (IntPtr) obj.GetValue(p);
IntPtr address = (IntPtr)obj.GetValue(p);
obj.SetValue(p, IntPtr.Zero);

try
Expand Down
6 changes: 5 additions & 1 deletion binding/go/porcupine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,6 @@ func TestProcessMessageStack(t *testing.T) {
if err != nil {
t.Fatalf("%v", err)
}
defer porcupine.Delete()

address := porcupine.handle
porcupine.handle = nil
Expand All @@ -332,4 +331,9 @@ func TestProcessMessageStack(t *testing.T) {
if err == nil {
t.Fatalf("Expected porcupine process to fail")
}

delErr := porcupine.Delete()
if delErr != nil {
t.Fatalf("%v", delErr)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -269,10 +269,10 @@ class PorcupineAppTestUITests: BaseTest {
p.delete()

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

do {
let res = p.process(testPcm)
let res = try p.process(pcm: testPcm)
XCTAssert(res == 100)
} catch {
XCTAssert("\(error.localizedDescription)".count > 0)
Expand Down
6 changes: 3 additions & 3 deletions binding/python/test_porcupine.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,13 @@ def test_process_message_stack(self):
model_path=get_model_path_by_language(relative_path, 'en'),
keyword_paths=get_keyword_paths_by_language(relative_path, 'en', ['porcupine']),
sensitivities=[0.5])
testPcm = [0] * p.frame_length
test_pcm = [0] * p.frame_length

address = p._handle
p._handle = None

try:
res = p.process(testPcm)
res = p.process(test_pcm)
self.assertEqual(res, 100)
except PorcupineError as e:
self.assertGreater(len(e.message_stack), 0)
Expand Down
2 changes: 1 addition & 1 deletion binding/unity/Assets/Porcupine/PorcupineException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public PorcupineException(string message, string[] messageStack) : base(ModifyMe
this._messageStack = messageStack;
}

public string[] messageStack
public string[] MessageStack
{
get => _messageStack;
}
Expand Down
2 changes: 1 addition & 1 deletion binding/unity/Assets/Porcupine/Tests/Integration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ public void TestProcessMessageStack()
short[] testPcm = new short[p.FrameLength];

var obj = typeof(Porcupine).GetField("_libraryPointer", BindingFlags.NonPublic | BindingFlags.Instance);
IntPtr address = (IntPtr) obj.GetValue(p);
IntPtr address = (IntPtr)obj.GetValue(p);
obj.SetValue(p, IntPtr.Zero);

try
Expand Down

0 comments on commit 7f5a218

Please sign in to comment.