-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathau_mex_test.m
46 lines (36 loc) · 981 Bytes
/
au_mex_test.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
%% Test au_mex.h
disp('mexing');
mex('au_mex_example_1.cxx');
mex('au_mex_example_2.cxx');
%%
disp('testing');
A = rand(2,3);
B = rand(2,3);
O = au_mex_example_1(A, B);
au_test_equal O (A+B)
disp('testing example1 with wrong size -- should fail');
au_test_should_fail('au_mex_example_1(1,1)');
%%
disp('testing example2<double>');
A = rand(2,3);
B = rand(2,3);
O = au_mex_example_2(A, B);
au_test_equal O (A+B)
disp('testing example2<uint8>');
A = randi(2,3, 'uint8');
B = randi(2,3, 'uint8');
O = au_mex_example_2(A, B);
au_test_equal O (A+B)
disp('testing example2<uint16> -- should fail');
au_test_should_fail('au_mex_example_2(uint16(A), uint16(B))');
%% Check for leaks
disp('Check for leaks...');
mex('au_mex_test_leak.cxx');
!tasklist /FI "imagename eq matlab.exe"
for k=1:10
for j=1:10000
au_mex_test_leak();
end
!tasklist /NH /FI "imagename eq matlab.exe"
end
disp('Done. If memory increased continually, report bug at awful.codeplex.com.');