Browse Source

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

tags/v0.1alpha1
Xianyi Zhang 15 years ago
parent
commit
c79696cc61
3 changed files with 72 additions and 3 deletions
  1. +4
    -1
      utest/common_utest.h
  2. +3
    -0
      utest/main.c
  3. +65
    -2
      utest/test_rot.c

+ 4
- 1
utest/common_utest.h View File

@@ -36,9 +36,12 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#include <common.h>

#define CHECK_EPS 0.0002
#define CHECK_EPS 0.00002

//Testcase list
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

+ 3
- 0
utest/main.c View File

@@ -38,7 +38,10 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <CUnit/Basic.h>

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 csrot when incx & incy == 0",test_csrot_incx_0},
{"Testing zdrot when incx & incy == 0",test_zdrot_incx_0},
CU_TEST_INFO_NULL,
};



+ 65
- 2
utest/test_rot.c View File

@@ -43,9 +43,72 @@ void test_drot_incx_0(void)
double y2[]={2.0,4.0,6.0,8.0};

//OpenBLAS
drot_(&N,x1,&incX,y1,&incY,&c,&s);
BLASFUNC(drot)(&N,x1,&incX,y1,&incY,&c,&s);
//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++){
CU_ASSERT_DOUBLE_EQUAL(x1[i], x2[i], CHECK_EPS);


Loading…
Cancel
Save