nobs_test.sas

Go to the documentation of this file.
00001  
00017 /*-- simple example with sashelp.class ---------------------------------------*/
00018 %initTestcase(i_object=nobs.sas, i_desc=simple example with sashelp.class)
00019 %let nobs=%nobs(sashelp.class);
00020 %endTestcall()
00021 %assertEquals(i_actual=&nobs, i_expected=19, i_desc=number of observations in sashelp.class)
00022 %endTestcase()
00023 
00024 /*-- failed test -------------------------------------------------------------*/
00025 %initTestcase(i_object=nobs.sas, i_desc=failed test)
00026 %let nobs=%nobs(sashelp.class);
00027 %endTestcall()
00028 %assertEquals(i_actual=&nobs, i_expected=20, i_desc=number of observations in dataset sashelp.class)
00029 %endTestcase()
00030 
00031 /*-- example with big dataset ------------------------------------------------*/
00032 %initTestcase(i_object=nobs.sas, i_desc=%str(example with big dataset))
00033 data big;
00034    do i=1 to 1000000;
00035       x=ranuni(0);
00036       output; 
00037    end;
00038 run; 
00039 %let nobs=%nobs(big);
00040 %endTestcall()
00041 %assertEquals(i_actual=&nobs, i_expected=1000000, i_desc=number of observations in dataset work.big)
00042 %endTestcase()
00043 
00044 /*-- example with empty dataset ----------------------------------------------*/
00045 %initTestcase(i_object=nobs.sas, i_desc=%str(example with empty dataset))
00046 data empty;
00047    stop; 
00048 run; 
00049 %let nobs=%nobs(empty);
00050 %endTestcall()
00051 %assertEquals(i_actual=&nobs, i_expected=0, i_desc=number of observations in dataset work.empty)
00052 %endTestcase()
00053 
00054 /*-- dataset not specified ---------------------------------------------------*/
00055 %initTestcase(i_object=nobs.sas, i_desc=%str(dataset not specified))
00056 %let nobs=%nobs(xxx);
00057 %endTestcall()
00058 %assertEquals(i_actual=&nobs, i_expected=, i_desc=number of observations when dataset is not specified)
00059 %endTestcase()
00060 
00061 /*-- invalid dataset ---------------------------------------------------------*/
00062 %initTestcase(i_object=nobs.sas, i_desc=%str(invalid dataset))
00063 %let nobs=%nobs(xxx);
00064 %endTestcall()
00065 %assertEquals(i_actual=&nobs, i_expected=, i_desc=number of observations with invalid dataset)
00066 %endTestcase()
00067 
00068 

Generated on Sun Oct 10 14:10:15 2010 for SASUnit Examples by  doxygen 1.5.3