Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 765f513c authored by hhakim's avatar hhakim
Browse files

Minor change in Matlab unit tests.

Relying on a internal static function member nnzero_count() rather than an external function defined in old_matlab/.
parent f93d9869
No related branches found
No related tags found
No related merge requests found
...@@ -47,6 +47,16 @@ classdef FaustTest < matlab.unittest.TestCase ...@@ -47,6 +47,16 @@ classdef FaustTest < matlab.unittest.TestCase
end end
end end
methods(Static)
function sumnnz = nnzero_count(factors)
sumnnz = 0
disp('size:');size(factors,2)
for i = 1:size(factors,2)
sumnnz = sumnnz + nnz(factors{i})
end
end
end
methods (Test) methods (Test)
function testSave(this) function testSave(this)
rand_suffix = int2str(randi(10000)) rand_suffix = int2str(randi(10000))
...@@ -125,7 +135,7 @@ classdef FaustTest < matlab.unittest.TestCase ...@@ -125,7 +135,7 @@ classdef FaustTest < matlab.unittest.TestCase
function testnnz(this) function testnnz(this)
disp('testnnz()') disp('testnnz()')
this.verifyEqual(nnz(this.test_faust), nnzero_count(this.factors)) this.verifyEqual(nnz(this.test_faust), FaustTest.nnzero_count(this.factors))
end end
function testDensity(this) function testDensity(this)
...@@ -139,7 +149,7 @@ classdef FaustTest < matlab.unittest.TestCase ...@@ -139,7 +149,7 @@ classdef FaustTest < matlab.unittest.TestCase
disp('testrcg()') disp('testrcg()')
ref_nlines = size(this.factors{1},1) ref_nlines = size(this.factors{1},1)
ref_ncols = size(this.factors{this.num_factors},2) ref_ncols = size(this.factors{this.num_factors},2)
this.verifyEqual(ref_nlines*ref_ncols/nnzero_count(this.factors), RCG(this.test_faust), 'RelTol', 0.01) this.verifyEqual(ref_nlines*ref_ncols/FaustTest.nnzero_count(this.factors), RCG(this.test_faust), 'RelTol', 0.01)
end end
function testend(this) function testend(this)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment