Added rot testcase when incx == incy ==1.

This commit is contained in:
Xianyi Zhang 2011-02-16 23:32:13 +08:00
parent 84ba64e65b
commit c79696cc61
3 changed files with 72 additions and 3 deletions

View File

@ -36,9 +36,12 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <common.h> #include <common.h>
#define CHECK_EPS 0.0002 #define CHECK_EPS 0.00002
//Testcase list //Testcase list
void test_drot_incx_0(void); void test_drot_incx_0(void);
void test_srot_incx_0(void);
void test_zdrot_incx_0(void);
void test_csrot_incx_0(void);
#endif #endif

View File

@ -38,7 +38,10 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <CUnit/Basic.h> #include <CUnit/Basic.h>
CU_TestInfo test_level1[]={ CU_TestInfo test_level1[]={
{"Testing srot when incx & incy == 0",test_srot_incx_0},
{"Testing drot when incx & incy == 0",test_drot_incx_0}, {"Testing drot when incx & incy == 0",test_drot_incx_0},
{"Testing csrot when incx & incy == 0",test_csrot_incx_0},
{"Testing zdrot when incx & incy == 0",test_zdrot_incx_0},
CU_TEST_INFO_NULL, CU_TEST_INFO_NULL,
}; };

View File

@ -43,9 +43,72 @@ void test_drot_incx_0(void)
double y2[]={2.0,4.0,6.0,8.0}; double y2[]={2.0,4.0,6.0,8.0};
//OpenBLAS //OpenBLAS
drot_(&N,x1,&incX,y1,&incY,&c,&s); BLASFUNC(drot)(&N,x1,&incX,y1,&incY,&c,&s);
//reference //reference
drotf_(&N,x2,&incX,y2,&incY,&c,&s); BLASFUNC_REF(drot)(&N,x2,&incX,y2,&incY,&c,&s);
for(i=0; i<N; i++){
CU_ASSERT_DOUBLE_EQUAL(x1[i], x2[i], CHECK_EPS);
CU_ASSERT_DOUBLE_EQUAL(y1[i], y2[i], CHECK_EPS);
}
}
void test_zdrot_incx_0(void)
{
int i;
int N=4,incX=0,incY=0;
double c=0.25,s=0.5;
double x1[]={1.0,3.0,5.0,7.0,1.0,3.0,5.0,7.0};
double y1[]={2.0,4.0,6.0,8.0,2.0,4.0,6.0,8.0};
double x2[]={1.0,3.0,5.0,7.0,1.0,3.0,5.0,7.0};
double y2[]={2.0,4.0,6.0,8.0,2.0,4.0,6.0,8.0};
//OpenBLAS
BLASFUNC(zdrot)(&N,x1,&incX,y1,&incY,&c,&s);
//reference
BLASFUNC_REF(zdrot)(&N,x2,&incX,y2,&incY,&c,&s);
for(i=0; i<N; i++){
CU_ASSERT_DOUBLE_EQUAL(x1[i], x2[i], CHECK_EPS);
CU_ASSERT_DOUBLE_EQUAL(y1[i], y2[i], CHECK_EPS);
}
}
void test_srot_incx_0(void)
{
int i;
int N=4,incX=0,incY=0;
float c=0.25,s=0.5;
float x1[]={1.0,3.0,5.0,7.0};
float y1[]={2.0,4.0,6.0,8.0};
float x2[]={1.0,3.0,5.0,7.0};
float y2[]={2.0,4.0,6.0,8.0};
//OpenBLAS
BLASFUNC(srot)(&N,x1,&incX,y1,&incY,&c,&s);
//reference
BLASFUNC_REF(srot)(&N,x2,&incX,y2,&incY,&c,&s);
for(i=0; i<N; i++){
CU_ASSERT_DOUBLE_EQUAL(x1[i], x2[i], CHECK_EPS);
CU_ASSERT_DOUBLE_EQUAL(y1[i], y2[i], CHECK_EPS);
}
}
void test_csrot_incx_0(void)
{
int i;
int N=4,incX=0,incY=0;
float c=0.25,s=0.5;
float x1[]={1.0,3.0,5.0,7.0,1.0,3.0,5.0,7.0};
float y1[]={2.0,4.0,6.0,8.0,2.0,4.0,6.0,8.0};
float x2[]={1.0,3.0,5.0,7.0,1.0,3.0,5.0,7.0};
float y2[]={2.0,4.0,6.0,8.0,2.0,4.0,6.0,8.0};
//OpenBLAS
BLASFUNC(csrot)(&N,x1,&incX,y1,&incY,&c,&s);
//reference
BLASFUNC_REF(csrot)(&N,x2,&incX,y2,&incY,&c,&s);
for(i=0; i<N; i++){ for(i=0; i<N; i++){
CU_ASSERT_DOUBLE_EQUAL(x1[i], x2[i], CHECK_EPS); CU_ASSERT_DOUBLE_EQUAL(x1[i], x2[i], CHECK_EPS);