//Compare the absolute value of two numbers
int abs_num_comp(numType *n1, numType *n2)
{
	int sign1 = n1->sign;
	int sign2 = n2->sign;
	int result;

	n1->sign = 1; n2->sign = 1;	//Temporary convert the number to positive value
	result = num_comp(n1, n2);
	n1->sign = sign1; n2->sign = sign2; //then now revert their sign

	return result;
}
    void TestRunOnCoarsestMesh() throw(Exception)
    {
        // run with h=0.05 and dt=0.01.  SVI is turned on
        Run(0.05, 0.01, 40, true);

        // test the activation times produced match those given for the Niederer et al paper
        std::string results_dir = OutputFileHandler::GetChasteTestOutputDirectory() + "ActivationMaps";
        std::string output_file = results_dir + "/activation_h0.05_dt0.01.dat";
        std::string base_file = "heart/test/data/benchmark_data_orig/activation_time_h0.05_dt0.01.dat";

        NumericFileComparison num_comp(output_file, base_file);
        TS_ASSERT(num_comp.CompareFiles(1.5e-3)); //Absolute difference of 1.5 microsecond is tolerated
    }
Esempio n. 3
0
static void
k5_to_k4_name(krb5_context k5context,
    krb5_principal k5princ,
    struct ktc_principal *ktcprinc)
{
    int i;

    switch(num_comp(k5context, k5princ)) {
	default:
	/* case 2: */
	    i = get_princ_len(k5context, k5princ, 1);
	    if (i > MAXKTCNAMELEN-1) i = MAXKTCNAMELEN-1;
	    memcpy(ktcprinc->instance, get_princ_str(k5context, k5princ, 1), i);
	    /* fall through */
	case 1:
	    i = get_princ_len(k5context, k5princ, 0);
	    if (i > MAXKTCNAMELEN-1) i = MAXKTCNAMELEN-1;
	    memcpy(ktcprinc->name, get_princ_str(k5context, k5princ, 0), i);
	    /* fall through */
	case 0:
	    break;
	}
}