Exemple #1
0
TEST(CSSTest, Selector_Count)
{

	CSSSelector test_a("p");

	ASSERT_EQ(1, test_a.count());

	CSSSelector test_b("h1, h2, h3");

	ASSERT_EQ(3, test_b.count());

	CSSSelector test_c("p span");

	ASSERT_EQ(1, test_c.count());

	CSSSelector test_d("p.section");

	ASSERT_EQ(1, test_d.count());

	CSSSelector test_e(".bold");

	ASSERT_EQ(1, test_e.count());

	CSSSelector test_f("#id");

	ASSERT_EQ(1, test_f.count());

}
Exemple #2
0
int main(int argc, char* argv[])
{
	int dummy;
	char cmd;
	double counter;

	dummy = (argc == INT_MAX - 1) ? argv[argc-1][0] : 1;

	if (argc == 3) {
		cmd = argv[1][1];
		counter = strtod(argv[2], NULL);
		if (counter < 0 || counter > UINT32_MAX)
			counter = 1;
	} else {
		cmd = 'j';
		counter = 1;
		usage(argv[0]);
	}

	if (!bpf_validate(insns, sizeof(insns) / sizeof(insns[0])))
		errx(EXIT_FAILURE, "Not valid bpf program");

	switch (cmd) {
	case 'j':
		test_bpfjit(counter, test_pkt, sizeof(test_pkt), dummy);
		break;
	case 'b':
		test_bpf_filter(counter, dummy);
		break;
	case 'c':
		test_c(counter, test_pkt, sizeof(test_pkt), dummy);
	}

	return EXIT_SUCCESS;
}
Exemple #3
0
int main(void)
{
	test_c();
	test_d();

	return EXIT_SUCCESS;
}
int main (void)
{
  test_c ('?');
  test_d_i (0xdeadbeef, 0xdeadbeefL);
  test_x ('?', 0xdead, 0xdeadbeef);

  test_a_double (0.0);
  test_e_double (0.0);
  test_f_double (0.0);
  test_g_double (0.0);

  test_a_long_double ();
  test_e_long_double (0.0);
  test_f_long_double ();
  test_g_long_double ();

  test_s (0);

  test_n ();

  test_percent ();

  if (nfails)
    {
      __builtin_printf ("%u out of %u tests failed\n", nfails, ntests);
      __builtin_abort ();
    }

  return 0;
}
Exemple #5
0
static void test_cs(app* x, expr_ref_vector& c, vector<expr_ref_vector> const& cs) {
    if (c.size() == cs.size()) {
        test_c(x, c);
        return;
    }
    expr_ref_vector const& c1 = cs[c.size()];
    for (unsigned i = 0; i < c1.size(); ++i) {
        c.push_back(c1[i]);
        test_cs(x, c, cs);
        c.pop_back();
    }
}
Exemple #6
0
//extern uchar pass_cut;
void criteria(cell *c)
{
    uchar let = 0, *raster = 0;
    cf::version *vers = 0;
    int16_t r = 0, flacc = 0, flon = 0, inc = 0;
    cf::version save[VERS_IN_CELL] = { 0 };
    int16_t snvers = 0;

    // #define PROB_V_OK 170
    if (c->nvers > 0)
        memcpy(save, c->vers, c->nvers);
    snvers = c->nvers;
    if (!c->nvers)
        return;
    get_b_lines(c, &bl);
    H = (int16_t) get_size();
    if (c->nvers == 1 && c->vers[0].let == '>')
        test_rq(c);
    if (c->nvers == 1 && ((let = c->vers[0].let) == 'c' || let == 'C') || (c->nvers == 2
            && (c->vers[0].let == 'c' && c->vers[1].let == 'C' || c->vers[0].let == 'C'
                    && c->vers[1].let == 'c')))
        test_c(c);
    if (c->nvers >= 2 && (c->vers[0].let == 'a' && c->vers[1].let == 'o' || c->vers[0].let == 'o'
            && c->vers[1].let == 'a'))
        crit_oa(c);
    for (vers = c->vers, flacc = flon = 0; (let = vers->let) != 0; vers++) {
        { //Andrew
            if ((let = vers->let) == liga_CC || let == liga_CR) {
                raster = save_raster(c);
                inc = AnglesCurve(raster, (int16_t) ((c->w + 7) / 8), c->h);
                inc = (4 - inc) * 40;
                if (3 * c ->w > 4 * c ->h)
                    inc += 150;
                if (3 * c ->w < 2 * c ->h)
                    inc += 150;

                if (c->env && c->env->nl < 4)
                    inc += 100;

                if (vers->prob > inc)
                    vers->prob -= inc;
                else
                    vers->prob = 0;
            }
        }

        if (((language == LANGUAGE_FRENCH || language == LANGUAGE_ITALIAN) && memchr(
                "ACEIOUaceiou", let, 12) || // Включая нижние акценты "c" 05.07.2002 E.P.
                language == LANGUAGE_SPANISH && memchr("AEINOUaeniou", let, 12) || language
                == LANGUAGE_GERMAN && memchr("AOUaou", let, 6) || language == LANGUAGE_RUSSIAN
                && memchr("Ґ…", let, 2) || language == LANGUAGE_CROATIAN
                && memchr("SZCszc", let, 6)
        /*&& !pass_cut*/|| language == LANGUAGE_POLISH && memchr("AESZCNOaeszcno", let, 14) || // Включая нижние акценты a,e 05.07.2002 E.P.
                language == LANGUAGE_PORTUGUESE && memchr("AEOUIaeoui", let, 10) || language
                == LANGUAGE_SWEDISH && memchr("AEOaeo", let, 6)) && !flacc ||

        // 05.09.2000 E.P.
                language == LANGUAGE_CZECH && memchr("AaCcDdEeIiNnOoRrSsTtUuYyZz", let, 26)
                || language == LANGUAGE_ROMANIAN && memchr("AaIiSsTt", let, 8) || // Включая нижние акценты s,t 05.07.2002 E.P.
                language == LANGUAGE_HUNGARIAN && memchr("AaEeIiOoUu", let, 10) || language
                == LANGUAGE_SLOVENIAN && memchr("CcSsZz", let, 6) ||

        // 09.07.2001 E.P.
                language == LANGUAGE_LATVIAN && memchr("AaCcEeGgIiKkLlNnSsUuZz", let, 22)
                || language == LANGUAGE_LITHUANIAN && memchr("AaCcEeIiSsUuZz", let, 14) || language
                == LANGUAGE_ESTONIAN && memchr("AaOoSsUuZz", let, 10) ||

        // 21.05.2002 E.P.
                language == LANGUAGE_TURKISH && (memchr("AaCcIiGgOoSsUu", let, 14) || let
                        == i_sans_accent) || 0) {
            flacc = 1;
            if (accent(c))
                break;
        }

        // Урезание чужих букв из общих таблиц
        if (language == LANGUAGE_POLISH && memchr("qQ", let, 2) ||

        // BULGAR 08.09.2000 E.P.
                language == LANGUAGE_RUSSIAN && langBul && (let == 155 || let == 235 || // Ыы 08.09.2000 E.P.
                        let == 157 || let == 237 || // Ээ 08.09.2000 E.P.
                        let == r_EE_2dot || let == r_e_2dot) ||

        language == LANGUAGE_SLOVENIAN && isnot_slovenian(let) ||

        // 09.07.2001 E.P.
                language == LANGUAGE_LATVIAN && isnot_latvian(let) || language
                == LANGUAGE_LITHUANIAN && isnot_lithuanian(let) || language == LANGUAGE_ESTONIAN
                && isnot_estonian(let) ||

        // 21.05.2002 E.P.
                language == LANGUAGE_TURKISH && isnot_turkish(let) || 0) {
            vers->prob >>= 1;
            if (vers->prob & 1)
                vers->prob--;
            if (!vers->prob)
                vers->prob = 2;
        }

        if (c->isBadLetter()) // Oleg : 02-28-96 04:55pm : letter only
            if (((let = vers->let) == 'i' || let == 'j' || (language == LANGUAGE_TURKISH && let
                    == II_dot_accent) // 17.06.2002 E.P.
            ) && (r = ij_dot(c)) != 0) {
                if (r > 0)
                    break;
                vers--;
                continue;
            }

        // Nick 18.06.2002
        if (language == LANGUAGE_TURKISH && ((let = vers->let) == i_sans_accent || let
                == II_dot_accent) && (r = upper_right_angle(c)) > 0) {
            vers->prob = MAX(2, vers->prob - r);
            continue;
        }

        if ((let = vers->let) == '!' || let == '?') {
            if (excl_dot(c) > 0)
                break;
            vers--;
            continue;
        }
        if (language != LANGUAGE_RUSSIAN) // refuse with  ,Ў
            if ((let = vers->let) == invers_exm || let == invers_qm) {
                if (inv_dot(c) > 0)
                    break;
                vers--;
                continue;
            }

        if ((language == LANGUAGE_FRENCH || language == LANGUAGE_TURKISH // 18.06.2002 E.P.
        ) && (vers->let == 'c' || vers->let == 'C'))
            c_to_ctail(c, 0); // AL 940321
        if (vers->let == liga_rt && not_rt(c)) {
            vers--;
            continue;
        }
        if (is_liga_ff(vers->let) && not_ff(c)) {
            vers--;
            continue;
        }

        if (vers->let == 'n' || vers->let == 'o')
            flon = 1;
    }
Exemple #7
0
void TestApp::test_matrix_mat4()
{
	Console::write_line("  Class: Mat4");

	Console::write_line("   Function: inverse()");
	{

		Mat4f test_src = Mat4f::rotate((Angle(30, angle_degrees)), 1.0, 0.0, 0.0, true);
		Mat4f test_inv;
		Mat4f test_dest;
		Mat4f test_ident = Mat4f::identity();

		test_dest = test_src;
		test_dest.inverse();
		test_dest = test_dest * test_src;

		if (test_ident != test_dest) fail();

	}

	static int test_a_values[] = {3, 1, 2, 4, 5 ,6, 4, 2, 1, 4, 6, 7, 6, 3, 7, 2};
	static int test_b_values[] = {4, 7, 2, 5, 3, 5, 2, 9, 3, 3, 6, 9, 2, 4, 6, 2};

	Mat4i test_a(test_a_values);
	Mat4i test_b(test_b_values);

	Mat4f test_c(test_a);
	Mat4f test_c_scaled(test_c);

	{
		float x = 2.0f;
		float y = 3.0f;
		float z = 4.0f;

		test_c_scaled[0 + 4 * 0] *= x;
		test_c_scaled[0 + 4 * 1] *= y;
		test_c_scaled[0 + 4 * 2] *= z;
		test_c_scaled[1 + 4 * 0] *= x;
		test_c_scaled[1 + 4 * 1] *= y;
		test_c_scaled[1 + 4 * 2] *= z;
		test_c_scaled[2 + 4 * 0] *= x;
		test_c_scaled[2 + 4 * 1] *= y;
		test_c_scaled[2 + 4 * 2] *= z;
		test_c_scaled[3 + 4 * 0] *= x;
		test_c_scaled[3 + 4 * 1] *= y;
		test_c_scaled[3 + 4 * 2] *= z;
	}

	Console::write_line("   Function: add() and operator");
	{
		int answer_values[] = {7, 8, 4, 9, 8, 11, 6, 11, 4, 7, 12, 16, 8, 7, 13, 4};
		Mat4i answer(answer_values);

		Mat4i result = test_a + test_b;
		if (result != answer) fail();

		result = Mat4i::add(test_a, test_b);
		if (result != answer) fail();

	}

	Console::write_line("   Function: subtract() and operator");
	{
		int answer_values[] = {-1, -6, 0, -1, 2, 1, 2, -7, -2, 1, 0, -2, 4, -1, 1, 0};
		Mat4i answer(answer_values);

		Mat4i result = test_a - test_b;
		if (result != answer) fail();

		result = Mat4i::subtract(test_a, test_b);
		if (result != answer) fail();

	}

	Console::write_line("   Function: translate()");
	{
		int answer_values[] = {1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 2, 3, 4, 1};
		Mat4i answer(answer_values);

		Mat4i result = Mat4i::translate(2, 3, 4);
		if (result != answer) fail();
	}

	Console::write_line("   Function: translate_self() (int)");
	{
		Mat4i answer(test_a);

		Mat4i result = test_a;
		result = result * Mat4i::translate(2, 3, 4);

		Mat4i result2 = test_a;
		result2.translate_self(2,3,4);

		if (result != result2) fail();
	}

	Console::write_line("   Function: translate_self() (float)");
	{
		Mat4f answer(test_a);

		Mat4f result(test_a);
		result = result * Mat4f::translate(2, 3, 4);

		Mat4f result2(test_a);
		result2.translate_self(2, 3, 4);

		if (!result.is_equal(result2, 0.00001f))
			fail();
	}

	Console::write_line("   Function: scale_self()");
	{
		Mat4i answer(test_a);

		Mat4i result = test_a;
		result = result * Mat4i::scale(2, 3, 4);

		Mat4i result2 = test_a;
		result2.scale_self(2,3,4);

		if (result != result2) fail();

		Mat4f test = test_c;
		test.scale_self(2.0f, 3.0f, 4.0f);

		if (!test.is_equal(test_c_scaled, 0.00001f))
			fail();
	}

	Console::write_line("   Function: rotate (using euler angles)");
	{
		Mat4f mv = Mat4f::identity();
		mv = mv * Mat4f::rotate(Angle(30.0f, angle_degrees), 0.0f, 0.0f, 1.0f, false);
		mv = mv * Mat4f::rotate(Angle(10.0f, angle_degrees), 1.0f, 0.0f, 0.0f, false);
		mv = mv * Mat4f::rotate(Angle(20.0f, angle_degrees), 0.0f, 1.0f, 0.0f, false);

		Mat4f test_matrix;
		test_matrix = Mat4f::rotate(Angle(10.0f, angle_degrees), Angle(20.0f, angle_degrees), Angle(30.0f, angle_degrees), order_YXZ);
		if (!test_matrix.is_equal(mv, 0.00001f))
			fail();

	}

	Console::write_line("   Function: rotate (using euler angles) and get_euler");
	{
		test_rotate_and_get_euler(order_XYZ);
		test_rotate_and_get_euler(order_XZY);
		test_rotate_and_get_euler(order_YZX);
		test_rotate_and_get_euler(order_YXZ);
		test_rotate_and_get_euler(order_ZXY);
		test_rotate_and_get_euler(order_ZYX);
	}

	Console::write_line("   Function: transpose() (float)");
	{
		Mat4f original(test_a);

		Mat4f transposed_matrix;
	
		transposed_matrix[0] = original[0];
		transposed_matrix[1] = original[4];
		transposed_matrix[2] = original[8];
		transposed_matrix[3] = original[12];
		transposed_matrix[4] = original[1];
		transposed_matrix[5] = original[5];
		transposed_matrix[6] = original[9];
		transposed_matrix[7] = original[13];
		transposed_matrix[8] = original[2];
		transposed_matrix[9] = original[6];
		transposed_matrix[10] = original[10];
		transposed_matrix[11] = original[14];
		transposed_matrix[12] = original[3];
		transposed_matrix[13] = original[7];
		transposed_matrix[14] = original[11];
		transposed_matrix[15] = original[15];

		Mat4f test = original;
		test.transpose();

		if (!test.is_equal(transposed_matrix, 0.00001f))
			fail();
	}
}