mirror of
https://github.com/sasjs/core.git
synced 2026-01-03 15:40:05 +00:00
feat: new macro for validating inputs (mp_validatecol.sas), also a refresh of the tests now that sasjs test is released. All tests are passing
This commit is contained in:
@@ -30,7 +30,3 @@ run;
|
||||
test=ALLVALS
|
||||
)
|
||||
|
||||
|
||||
%webout(OPEN)
|
||||
%webout(OBJ, TEST_RESULTS)
|
||||
%webout(CLOSE)
|
||||
@@ -125,8 +125,3 @@ run;
|
||||
outds=work.test_results
|
||||
)
|
||||
|
||||
|
||||
|
||||
%webout(OPEN)
|
||||
%webout(OBJ, TEST_RESULTS)
|
||||
%webout(CLOSE)
|
||||
@@ -120,7 +120,3 @@ run;
|
||||
outds=work.test_results
|
||||
)
|
||||
|
||||
|
||||
%webout(OPEN)
|
||||
%webout(OBJ, TEST_RESULTS)
|
||||
%webout(CLOSE)
|
||||
@@ -66,7 +66,3 @@ run;
|
||||
outds=work.test_results
|
||||
)
|
||||
|
||||
|
||||
%webout(OPEN)
|
||||
%webout(OBJ, TEST_RESULTS)
|
||||
%webout(CLOSE)
|
||||
62
tests/base/mp_validatecol.test.sas
Normal file
62
tests/base/mp_validatecol.test.sas
Normal file
@@ -0,0 +1,62 @@
|
||||
/**
|
||||
@file
|
||||
@brief Testing mp_validatecol.sas macro
|
||||
|
||||
<h4> SAS Macros </h4>
|
||||
@li mp_assertdsobs.sas
|
||||
@li mp_validatecol.sas
|
||||
|
||||
**/
|
||||
|
||||
|
||||
/**
|
||||
* Test 1 - LIBDS
|
||||
*/
|
||||
data test1;
|
||||
infile datalines4 dsd;
|
||||
input;
|
||||
libds=_infile_;
|
||||
%mp_validatecol(libds,LIBDS,is_libds)
|
||||
if libds=1;
|
||||
datalines4;
|
||||
some.libname
|
||||
!lib.blah
|
||||
%abort
|
||||
definite.ok
|
||||
not.ok!
|
||||
nineletrs._
|
||||
;;;;
|
||||
run;
|
||||
%mp_assertdsobs(work.test1,
|
||||
desc=Testing LIBDS,
|
||||
test=EQUALS 2,
|
||||
outds=work.test_results
|
||||
)
|
||||
|
||||
/**
|
||||
* Test 2 - ISNUM
|
||||
*/
|
||||
data test2;
|
||||
infile datalines4 dsd;
|
||||
input;
|
||||
infile=_infile_;
|
||||
%mp_validatecol(infile,ISNUM,is_numeric)
|
||||
if is_numeric=1;
|
||||
datalines4;
|
||||
1
|
||||
0001
|
||||
1e6
|
||||
-44
|
||||
above are good
|
||||
the rest are bad
|
||||
%abort
|
||||
1&somethingverybad.
|
||||
&
|
||||
+-1
|
||||
;;;;
|
||||
run;
|
||||
%mp_assertdsobs(work.test2,
|
||||
desc=Test2 - ISNUM,
|
||||
test=EQUALS 4,
|
||||
outds=work.test_results
|
||||
)
|
||||
9
tests/testterm.sas
Normal file
9
tests/testterm.sas
Normal file
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
@file
|
||||
@brief term file for tests
|
||||
|
||||
**/
|
||||
|
||||
%webout(OPEN)
|
||||
%webout(OBJ, TEST_RESULTS)
|
||||
%webout(CLOSE)
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
<h4> SAS Macros </h4>
|
||||
@li mv_createwebservice.sas
|
||||
@li mv_getjobcode.sas
|
||||
|
||||
**/
|
||||
|
||||
@@ -21,4 +22,20 @@ run;
|
||||
path=&mcTestAppLoc/tests/macros,
|
||||
code=testref,
|
||||
name=mv_createwebservice
|
||||
)
|
||||
)
|
||||
|
||||
filename compare temp;
|
||||
%mv_getjobcode(
|
||||
path=&mcTestAppLoc/tests/macros
|
||||
,name=mv_createwebservice
|
||||
,outref=compare;
|
||||
)
|
||||
|
||||
data test_results;
|
||||
length test_description $256 test_result $4 test_comments $256;
|
||||
infile compare;
|
||||
input;
|
||||
if _infile_='01'x then test_result='PASS';
|
||||
else test_result='FAIL';
|
||||
test_description="Creating web service with invisible character";
|
||||
run;
|
||||
Reference in New Issue
Block a user