Skip to content

Commit 43362d2

Browse files
committed
TestHash dynamic
1 parent 96cf956 commit 43362d2

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

test/TestHash.m

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
classdef (SharedTestFixtures={ matlab.unittest.fixtures.PathFixture(fileparts(fileparts(mfilename('fullpath'))))}, ...
2-
TestTags = {'R2021a', 'impure'}) ...
2+
TestTags = {'R2019b', 'impure'}) ...
33
TestHash < matlab.unittest.TestCase
44

55
properties
@@ -9,16 +9,10 @@
99
properties (TestParameter)
1010
Ph = {{'md5', '5d41402abc4b2a76b9719d911017c592'}, ...
1111
{'sha-256', '2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824'}}
12-
backend
12+
backend = {'java', 'dotnet', 'sys'}
1313
end
1414

1515

16-
methods (TestParameterDefinition, Static)
17-
function backend = setupBackends()
18-
backend = init_backend("file_checksum");
19-
end
20-
end
21-
2216
methods(TestClassSetup)
2317
function create_file(tc)
2418
tc.applyFixture(matlab.unittest.fixtures.WorkingFolderFixture())
@@ -39,13 +33,19 @@ function create_file(tc)
3933
methods (Test)
4034

4135
function test_hash_text(tc, Ph, backend)
36+
4237
[r, b] = stdlib.file_checksum(tc.file, Ph{1}, backend);
4338
tc.assertEqual(char(b), backend)
4439
tc.verifyClass(r, 'char')
4540

46-
tc.verifyEqual(r, Ph{2})
41+
if ismember(backend, stdlib.Backend().select('file_checksum'))
42+
tc.verifyEqual(r, Ph{2})
43+
else
44+
tc.assertEmpty(r)
45+
end
4746
end
4847

48+
4949
function test_has_convenience(tc, Ph)
5050
switch Ph{1}
5151
case 'md5', tc.verifyEqual(stdlib.md5sum(tc.file), Ph{2})

0 commit comments

Comments
 (0)