/**
Reads the input config file created by sysstart_apparc_setup.bat and returns the
test case number (Defined in sysstart_apparc_run.bat)
@return TInt - the test case number
*/
TInt CSysStartApparcTestCase::ReadConfigFileL()
	{
	RFs	fs;
 	User::LeaveIfError(fs.Connect());
 	CleanupClosePushL(fs);

 	RFileReadStream reader;
	User::LeaveIfError(reader.Open(fs, KApparcConfigFile, EFileRead));
	CleanupClosePushL(reader);

	TChar delimChar('=');

	TBuf8<255> aDes;
	reader.ReadL(aDes, delimChar);

	//Read in a two character representation of a number and convert to an integer
	TChar result1(reader.ReadInt8L());
	TChar result0(reader.ReadInt8L());
	TInt aTestCase = result1.GetNumericValue()*10 + result0.GetNumericValue();

	// clean-up
	CleanupStack::PopAndDestroy(2, &fs);

	return aTestCase;

	}
Esempio n. 2
0
static void test_type2index_list()
{
    Tensor<float, 5> tensor(2,3,5,7,11);
    tensor.setRandom();
    tensor += tensor.constant(10.0f);

    typedef Eigen::IndexList<Eigen::type2index<0>> Dims0;
    typedef Eigen::IndexList<Eigen::type2index<0>, Eigen::type2index<1>> Dims1;
    typedef Eigen::IndexList<Eigen::type2index<0>, Eigen::type2index<1>, Eigen::type2index<2>> Dims2;
    typedef Eigen::IndexList<Eigen::type2index<0>, Eigen::type2index<1>, Eigen::type2index<2>, Eigen::type2index<3>> Dims3;
    typedef Eigen::IndexList<Eigen::type2index<0>, Eigen::type2index<1>, Eigen::type2index<2>, Eigen::type2index<3>, Eigen::type2index<4>> Dims4;

#if 0
    EIGEN_STATIC_ASSERT((internal::indices_statically_known_to_increase<Dims0>()() == true), YOU_MADE_A_PROGRAMMING_MISTAKE);
    EIGEN_STATIC_ASSERT((internal::indices_statically_known_to_increase<Dims1>()() == true), YOU_MADE_A_PROGRAMMING_MISTAKE);
    EIGEN_STATIC_ASSERT((internal::indices_statically_known_to_increase<Dims2>()() == true), YOU_MADE_A_PROGRAMMING_MISTAKE);
    EIGEN_STATIC_ASSERT((internal::indices_statically_known_to_increase<Dims3>()() == true), YOU_MADE_A_PROGRAMMING_MISTAKE);
    EIGEN_STATIC_ASSERT((internal::indices_statically_known_to_increase<Dims4>()() == true), YOU_MADE_A_PROGRAMMING_MISTAKE);
#endif

    EIGEN_STATIC_ASSERT((internal::are_inner_most_dims<Dims0, 1, ColMajor>::value == true), YOU_MADE_A_PROGRAMMING_MISTAKE);
    EIGEN_STATIC_ASSERT((internal::are_inner_most_dims<Dims1, 2, ColMajor>::value == true), YOU_MADE_A_PROGRAMMING_MISTAKE);
    EIGEN_STATIC_ASSERT((internal::are_inner_most_dims<Dims2, 3, ColMajor>::value == true), YOU_MADE_A_PROGRAMMING_MISTAKE);
    EIGEN_STATIC_ASSERT((internal::are_inner_most_dims<Dims3, 4, ColMajor>::value == true), YOU_MADE_A_PROGRAMMING_MISTAKE);
    EIGEN_STATIC_ASSERT((internal::are_inner_most_dims<Dims4, 5, ColMajor>::value == true), YOU_MADE_A_PROGRAMMING_MISTAKE);

    EIGEN_STATIC_ASSERT((internal::are_inner_most_dims<Dims0, 1, RowMajor>::value == true), YOU_MADE_A_PROGRAMMING_MISTAKE);
    EIGEN_STATIC_ASSERT((internal::are_inner_most_dims<Dims1, 2, RowMajor>::value == true), YOU_MADE_A_PROGRAMMING_MISTAKE);
    EIGEN_STATIC_ASSERT((internal::are_inner_most_dims<Dims2, 3, RowMajor>::value == true), YOU_MADE_A_PROGRAMMING_MISTAKE);
    EIGEN_STATIC_ASSERT((internal::are_inner_most_dims<Dims3, 4, RowMajor>::value == true), YOU_MADE_A_PROGRAMMING_MISTAKE);
    EIGEN_STATIC_ASSERT((internal::are_inner_most_dims<Dims4, 5, RowMajor>::value == true), YOU_MADE_A_PROGRAMMING_MISTAKE);

    const Dims0 reduction_axis0;
    Tensor<float, 4> result0 = tensor.sum(reduction_axis0);
    for (int m = 0; m < 11; ++m) {
        for (int l = 0; l < 7; ++l) {
            for (int k = 0; k < 5; ++k) {
                for (int j = 0; j < 3; ++j) {
                    float expected = 0.0f;
                    for (int i = 0; i < 2; ++i) {
                        expected += tensor(i,j,k,l,m);
                    }
                    VERIFY_IS_APPROX(result0(j,k,l,m), expected);
                }
            }
        }
    }

    const Dims1 reduction_axis1;
    Tensor<float, 3> result1 = tensor.sum(reduction_axis1);
    for (int m = 0; m < 11; ++m) {
        for (int l = 0; l < 7; ++l) {
            for (int k = 0; k < 5; ++k) {
                float expected = 0.0f;
                for (int j = 0; j < 3; ++j) {
                    for (int i = 0; i < 2; ++i) {
                        expected += tensor(i,j,k,l,m);
                    }
                }
                VERIFY_IS_APPROX(result1(k,l,m), expected);
            }
        }
    }

    const Dims2 reduction_axis2;
    Tensor<float, 2> result2 = tensor.sum(reduction_axis2);
    for (int m = 0; m < 11; ++m) {
        for (int l = 0; l < 7; ++l) {
            float expected = 0.0f;
            for (int k = 0; k < 5; ++k) {
                for (int j = 0; j < 3; ++j) {
                    for (int i = 0; i < 2; ++i) {
                        expected += tensor(i,j,k,l,m);
                    }
                }
            }
            VERIFY_IS_APPROX(result2(l,m), expected);
        }
    }

    const Dims3 reduction_axis3;
    Tensor<float, 1> result3 = tensor.sum(reduction_axis3);
    for (int m = 0; m < 11; ++m) {
        float expected = 0.0f;
        for (int l = 0; l < 7; ++l) {
            for (int k = 0; k < 5; ++k) {
                for (int j = 0; j < 3; ++j) {
                    for (int i = 0; i < 2; ++i) {
                        expected += tensor(i,j,k,l,m);
                    }
                }
            }
        }
        VERIFY_IS_APPROX(result3(m), expected);
    }

    const Dims4 reduction_axis4;
    Tensor<float, 0> result4 = tensor.sum(reduction_axis4);
    float expected = 0.0f;
    for (int m = 0; m < 11; ++m) {
        for (int l = 0; l < 7; ++l) {
            for (int k = 0; k < 5; ++k) {
                for (int j = 0; j < 3; ++j) {
                    for (int i = 0; i < 2; ++i) {
                        expected += tensor(i,j,k,l,m);
                    }
                }
            }
        }
    }
    VERIFY_IS_APPROX(result4(), expected);
}