Macros for SAS Application Developers
https://github.com/sasjs/core
Loading...
Searching...
No Matches
mp_base64copy.test.sas
Go to the documentation of this file.
1/**
2 @file
3 @brief Testing mp_base64copy.sas macro
4
5 <h4> SAS Macros </h4>
6 @li mp_base64copy.sas
7 @li mp_assert.sas
8
9**/
10
11
12/* TEST 1 - regular base64 decode */
13
14%let string1=base ik ally;
15filename tmp temp;
16data _null_;
17 file tmp;
18 put "&string1";
19run;
20%mp_base64copy(inref=tmp, outref=myref, action=ENCODE)
21
22data _null_;
23 infile myref;
24 input;
25 put _infile_;
26run;
27%mp_base64copy(inref=myref, outref=mynewref, action=DECODE)
28data _null_;
29 infile mynewref lrecl=5000;
30 input;
31 put _infile_;
32 call symputx('string1_check',_infile_);
33 stop;
34run;
35%mp_assert(
36 iftrue=("&string1"="&string1_check"),
37 desc=Basic String Compare,
38 outds=work.test_results
39)
40
41
42/* multibyte string check */
43
44filename tmp2 temp lrecl=500;
45data _null_;
46 file tmp2;
47 put "'╤', '╔', '╗', '═', '╧', '╚', '╝', '║', '╟', '─', '┼', '║', '╢', '│'";
48run;
49%mp_base64copy(inref=tmp2, outref=myref2, action=ENCODE)
50
51%mp_base64copy(inref=myref2, outref=newref2, action=DECODE)
52data _null_;
53 infile newref2 lrecl=5000;
54 input;
55 list;
56 /* do not print the string to the log else viya 3.5 throws exception */
57 if trim(_infile_)=
58 "'╤', '╔', '╗', '═', '╧', '╚', '╝', '║', '╟', '─', '┼', '║', '╢', '│'"
59 then call symputx('check2',1);
60 else call symputx('check2',0);
61 stop;
62run;
63%mp_assert(
64 iftrue=("&check2"="1"),
65 desc=Double Byte String Compare,
66 outds=work.test_results
67)