11classdef (SharedTestFixtures = { matlab .unittest .fixtures .PathFixture(fileparts(fileparts(mfilename(' fullpath' ))))}, ...
2- TestTags = {' R2021a ' , ' impure' }) ...
2+ TestTags = {' R2019b ' , ' impure' }) ...
33 TestHash < matlab .unittest .TestCase
44
55properties
99properties (TestParameter )
1010Ph = {{' md5' , ' 5d41402abc4b2a76b9719d911017c592' }, ...
1111 {' sha-256' , ' 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824' }}
12- backend
12+ backend = { ' java ' , ' dotnet ' , ' sys ' }
1313end
1414
1515
16- methods (TestParameterDefinition , Static )
17- function backend = setupBackends()
18- backend = init_backend(" file_checksum" );
19- end
20- end
21-
2216methods (TestClassSetup )
2317function create_file(tc )
2418tc .applyFixture(matlab .unittest .fixtures .WorkingFolderFixture())
@@ -39,13 +33,19 @@ function create_file(tc)
3933methods (Test )
4034
4135function test_hash_text(tc , Ph , backend )
36+
4237[r , b ] = stdlib .file_checksum(tc .file , Ph{1 }, backend );
4338tc .assertEqual(char(b ), backend )
4439tc .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
4746end
4847
48+
4949function test_has_convenience(tc , Ph )
5050switch Ph{1 }
5151 case ' md5' , tc .verifyEqual(stdlib .md5sum(tc .file ), Ph{2 })
0 commit comments