Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
faust
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
GitLab upgrade completed. Current version is 17.11.4.
Show more breadcrumbs
faust group
faust
Commits
c0c5ac62
Commit
c0c5ac62
authored
7 years ago
by
hhakim
Browse files
Options
Downloads
Patches
Plain Diff
Add a Matlab unit tests class for Faust class defined in Faust.m.
parent
58136e70
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
misc/test/CMakeLists.txt
+1
-1
1 addition, 1 deletion
misc/test/CMakeLists.txt
misc/test/src/Matlab/FaustTest.m
+91
-0
91 additions, 0 deletions
misc/test/src/Matlab/FaustTest.m
with
92 additions
and
1 deletion
misc/test/CMakeLists.txt
+
1
−
1
View file @
c0c5ac62
...
...
@@ -125,7 +125,7 @@ if(BUILD_WRAPPER_MATLAB)
add_test
(
NAME MATLAB_FAUST_SPEED COMMAND matlab -nojvm -r
"try;testpass=0;addpath('
${
FAUST_BIN_TEST_BIN_DIR
}
','
${
FAUST_BIN_TEST_TOOLS_DIR
}
');set_path;test_matlab_faust_time;catch ME ;testpass=-1;disp(getReport(ME)); end ; exit(testpass)"
)
add_test
(
NAME MATLAB_FAUST_UNIT_TESTS COMMAND matlab -nodisplay -nojvm -r
"try;testpass=0;FaustTest
${
PROJECT_BINARY_DIR
}
/wrapper/matlab/
${
PROJECT_BINARY_DIR
}
/run_test/bin
${
PROJECT_BINARY_DIR
}
/run_test/tools;cactch ME;testpass=-1;displ(getReport(ME));end;exit(testpass)"
)
#FIN MODIF NB VM MAC XCode
...
...
This diff is collapsed.
Click to expand it.
misc/test/src/Matlab/FaustTest.m
0 → 100644
+
91
−
0
View file @
c0c5ac62
classdef
FaustTest
<
matlab
.
unittest
.
TestCase
% Tests the Faust class.
properties
test_faust
faust_paths
end
properties
(
Constant
=
true
)
MAX_NUM_FACTORS
=
64
MAX_DIM_SIZE
=
1024
end
methods
(
TestClassSetup
)
function
initializeRandSeed
(
this
)
rng
(
'shuffle'
)
end
end
methods
(
TestMethodSetup
)
function
addFaustToPath
(
this
)
addpath
(
this
.
faust_paths
{:})
set_path
end
function
instantiateTestFaust
(
this
)
num_factors
=
randi
(
this
.
MAX_NUM_FACTORS
)
density
=
0.1
d2
=
randi
(
this
.
MAX_DIM_SIZE
);
factors
=
cell
(
1
,
num_factors
);
for
i
=
1
:
num_factors
d1
=
d2
;
d2
=
randi
(
this
.
MAX_DIM_SIZE
);
factors
{
i
}
=
sprand
(
d1
,
d2
,
density
);
end
this
.
test_faust
=
Faust
(
factors
,
1.0
,
0
)
end
end
methods
(
TestMethodTeardown
)
function
deleteTestFaust
(
this
)
delete
(
this
.
test_faust
)
end
end
methods
(
Test
)
function
testSave
(
this
)
rand_suffix
=
int2str
(
randi
(
10000
))
filepath
=
[
tempdir
filesep
'test_faust'
rand_suffix
'.mat'
]
save_core
(
this
.
test_faust
,
filepath
)
F
=
Faust
(
filepath
)
for
i
=
1
:
get_nb_factor
(
F
)
this
.
verifyEqual
(
get_fact
(
this
.
test_faust
,
i
),
get_fact
(
F
,
i
))
end
delete
(
filepath
)
end
function
testSave2
(
this
)
rand_suffix
=
int2str
(
randi
(
10000
))
filepath_ref
=
[
tempdir
filesep
'ref_faust'
rand_suffix
'.mat'
]
filepath_test
=
[
tempdir
filesep
'test_faust'
rand_suffix
'.mat'
]
nb_fact
=
get_nb_factor
(
this
.
test_faust
);
faust_factors
=
cell
(
1
,
nb_fact
);
for
i
=
1
:
nb_fact
faust_factors
{
i
}
=
get_fact
(
this
.
test_faust
,
i
);
end
save
(
filepath_ref
,
'faust_factors'
);
save_core
(
this
.
test_faust
,
filepath_test
)
ref_F
=
Faust
(
filepath_ref
)
test_F
=
Faust
(
filepath_test
)
this
.
verifyEqual
(
get_nb_factor
(
ref_F
),
get_nb_factor
(
test_F
))
for
i
=
1
:
get_nb_factor
(
ref_F
)
this
.
verifyEqual
(
get_fact
(
ref_F
,
i
),
get_fact
(
test_F
,
i
))
end
delete
(
filepath_ref
)
delete
(
filepath_test
)
end
end
methods
function
faust_test
=
FaustTest
(
varargin
)
faust_test
.
faust_paths
=
varargin
run
(
faust_test
)
end
end
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment