11classdef TestHash < matlab .unittest .TestCase
22
3+ properties (TestParameter )
4+ type = {' sha256' , ' md5' }
5+ hash = {" 36c1bbbdfd8d04ef546ffb15b9c0a65767fd1fe9a6135a257847e3a51fb1426c" , " d58cfb32e075781ba59082a8b18287f9" }
6+ end
7+
38methods (TestClassSetup )
49function setup_path(tc )
510import matlab .unittest .fixtures .PathFixture
@@ -9,7 +14,7 @@ function setup_path(tc)
914end
1015end
1116
12- methods (Test )
17+ methods (Test , ParameterCombination = ' sequential ' )
1318
1419function test_extract(tc )
1520import matlab .unittest .constraints .IsFile
@@ -30,21 +35,17 @@ function test_extract(tc)
3035
3136end
3237
33- function test_sha256 (tc )
38+ function test_hash (tc , type , hash )
3439
3540r = fileparts(mfilename(' fullpath' ));
36- fn = stdlib .join(r , " hello.tar.zst" );
37-
38- tc .verifyEqual(stdlib .sha256sum(fn ), " 36c1bbbdfd8d04ef546ffb15b9c0a65767fd1fe9a6135a257847e3a51fb1426c" )
41+ fn = fullfile(r , " hello.tar.zst" );
3942
43+ switch type
44+ case ' sha256' , h = stdlib .sha256sum(fn );
45+ case ' md5' , h = stdlib .md5sum(fn );
4046end
4147
42- function test_md5sum(tc )
43-
44- r = fileparts(mfilename(' fullpath' ));
45- fn = stdlib .join(r , " hello.tar.zst" );
46-
47- tc .verifyEqual(stdlib .md5sum(fn ), " d58cfb32e075781ba59082a8b18287f9" )
48+ tc .verifyEqual(h , hash )
4849
4950end
5051
0 commit comments