Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 79a9fd03 authored by hhakim's avatar hhakim
Browse files

Add unit tests for Faust deletion.

It ensures that a transpose Faust has still access to the original Faust shared C++ object used on background.
parent 38d6bfd1
No related branches found
No related tags found
No related merge requests found
...@@ -182,6 +182,15 @@ classdef FaustTest < matlab.unittest.TestCase ...@@ -182,6 +182,15 @@ classdef FaustTest < matlab.unittest.TestCase
disp('Test Faust.conj()') disp('Test Faust.conj()')
%TODO (when the funciton will be implemented) %TODO (when the funciton will be implemented)
end end
function testDelete(this)
disp('Test Faust.delete()')
tFaust = transpose(this.test_faust)
delete(this.test_faust)
this.verifyError(@() size(this.test_faust),'MATLAB:class:InvalidHandle')
this.verifyEqual(size(tFaust), [size(this.factors{this.num_factors},2), size(this.factors{1},1)])
end
end end
methods methods
......
...@@ -30,6 +30,7 @@ class TestFaustPy(unittest.TestCase): ...@@ -30,6 +30,7 @@ class TestFaustPy(unittest.TestCase):
self.F.get_nb_cols()) self.F.get_nb_cols())
print("Num. factors:", num_factors) print("Num. factors:", num_factors)
self.r = r self.r = r
self.num_factors = num_factors
def testSave(self): def testSave(self):
print("testSave()") print("testSave()")
...@@ -212,6 +213,16 @@ class TestFaustPy(unittest.TestCase): ...@@ -212,6 +213,16 @@ class TestFaustPy(unittest.TestCase):
print("testSize()") print("testSize()")
self.assertEqual((self.F.get_nb_rows(),self.F.get_nb_cols()), self.F.size()) self.assertEqual((self.F.get_nb_rows(),self.F.get_nb_cols()), self.F.size())
def testDelete(self):
print("Test del Faust")
tF = self.F.transpose()
F = self.F
del F
with self.assertRaises(UnboundLocalError):
print(F.size())
self.assertEqual(tF.size(), (self.factors[self.num_factors-1].shape[1],
self.factors[0].shape[0]))
if __name__ == "__main__": if __name__ == "__main__":
if(len(sys.argv)> 1): if(len(sys.argv)> 1):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment