From d8bc1ab06ffaa8644c16f01c22a9d3df6b5ede1e Mon Sep 17 00:00:00 2001 From: ananmaysuri2000@gmail.com Date: Tue, 11 May 2021 23:36:36 +0530 Subject: added tests for structure and string support --- tests/test.sce | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) (limited to 'tests') diff --git a/tests/test.sce b/tests/test.sce index b3a7993..edae0e7 100644 --- a/tests/test.sce +++ b/tests/test.sce @@ -370,6 +370,61 @@ else disp("cheb2ord Test failed") end +/////////Test case for base64encode ////////// + +s = octave_fun("base64encode","strings","Hakuna Matata","true"); + +if(s == "SGFrdW5hIE1hdGF0YQ==") + test_pass=[test_pass,1] +else + test_pass=[test_pass,0] + disp("base64encode Test failed") +end + +/////////Test case for getfields ////////// + +st = struct('double',25.25,'string','c++','complex',4 + 3*%i,'matrix',[1 2 3.56;4 5 6*%i]); +[od,os,oc,om] = octave_fun("getfields","struct",st,'double','string','complex','matrix'); + +if(od == 25.25 & os == "c++" & oc == 4 + 3*%i & om == [1 2 3.56;4 5 6*%i]) + test_pass=[test_pass,1] +else + test_pass=[test_pass,0] + disp("getfields Test failed") +end + +/////////Test case for options ////////// + +opt = octave_fun("options","control","string","c++","double",25.25,"complex",4 + 3*%i,"matrix",[1 2 3.56;4 5 6*%i]) + +if(opt.string == "c++" & opt.double == 25.25 & opt.complex == 4 + 3*%i & opt.matrix == [1 2 3.56;4 5 6*%i]) + test_pass=[test_pass,1] +else + test_pass=[test_pass,0] + disp("options Test failed") +end + +/////////Test case for poly2trellis ////////// + +trellis = octave_fun("poly2trellis","communications",[4 3],[4 5 17;7 4 2]); + +if(trellis.numInputSymbols == 4) + test_pass=[test_pass,1] +else + test_pass=[test_pass,0] + disp("poly2trellis Test failed") +end + +/////////Test case for convenc ////////// + +//code = octave_fun("convenc","communications",ones(100,1),trellis); + +//if(size(code) == [150 1]) +// test_pass=[test_pass,1] +//else +// test_pass=[test_pass,0] +// disp("convenc Test failed") +//end ///////////////////////////////////////////// res=find(test_pass==0) -- cgit