Beispiel #1
0
void test_format(test_harness& t) {
    test_format(t, std::ios::dec, "dec.");
    test_format(t, std::ios::oct|std::ios::showbase,  "oct.");
    test_format(t, std::ios::hex|std::ios::uppercase, "hex.");

    char buffer[64];
    std::ostringstream s;
    s << std::boolalpha;

    for (int i = 0; i <= 0x7ff; i++) {
        *sam::format_sam(buffer, i, s) = '\0';
        t.check(sam::parse_flags(buffer), i, std::string("symbolic.") + buffer);
    }
}
Beispiel #2
0
int main()
{
	plan(20);
	test_uints();
	test_ints();
	test_bools();
	test_floats();
	test_doubles();
	test_nils();
	test_strls();
	test_binls();
	test_strs();
	test_bins();
	test_arrays();
	test_maps();
	test_next_on_arrays();
	test_next_on_maps();
	test_compare_uints();
	test_format();
	test_mp_print();
	test_mp_check();
	test_numbers();
	test_overflow();

	return check_plan();
}
Beispiel #3
0
PIGLIT_GL_TEST_CONFIG_END

void
piglit_init(int argc, char **argv)
{
	bool pass;

        /* We can create depth/stencil textures if either:
         * 1. We have GL 3.0 or later
         * 2. We have GL_EXT_packed_depth_stencil and GL_ARB_depth_texture
         */
	if (piglit_get_gl_version() < 30
	    && !(piglit_is_extension_supported("GL_EXT_packed_depth_stencil") &&
		 piglit_is_extension_supported("GL_ARB_depth_texture"))) {
		printf("OpenGL 3.0 or GL_EXT_packed_depth_stencil + "
		       "GL_ARB_depth_texture is required.\n");
		piglit_report_result(PIGLIT_SKIP);
	}

	pass = test_format(GL_DEPTH24_STENCIL8_EXT,
			   GL_DEPTH_STENCIL_EXT,
			   GL_UNSIGNED_INT_24_8_EXT,
			   4);

	piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
}
Beispiel #4
0
enum piglit_result
piglit_display(void)
{
	glEnableVertexAttribArray(0);
	glEnableVertexAttribArray(1);

	glActiveTexture(GL_TEXTURE0);

	glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float),
			      vertex_data);
	glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float),
			      (void*) (vertex_data + (2 * sizeof(float))));

	bool pass = true;

	const struct fmt_test *test = tests;

	/* Loop over each format. */
	for (unsigned i = 0; i < ARRAY_SIZE(tests); i++, test++) {
		bool fmt_pass = test_format(test);
		piglit_report_subtest_result(PIGLIT_RESULT(fmt_pass),
					     "format 0x%x",
					     test->iformat);
		pass &= fmt_pass;
	}

	if (!piglit_check_gl_error(GL_NO_ERROR))
		piglit_report_result(PIGLIT_FAIL);

	return PIGLIT_RESULT(pass);
}
Beispiel #5
0
static int create(struct gl_hwdec *hw)
{
    GL *gl = hw->gl;

    struct priv *p = talloc_zero(hw, struct priv);
    hw->priv = p;
    p->current_image.buf = p->current_image.image_id = VA_INVALID_ID;
    p->log = hw->log;

    if (hw->hwctx)
        return -1;
    if (!eglGetCurrentDisplay())
        return -1;

    if (!strstr(gl->extensions, "EXT_image_dma_buf_import") ||
        !strstr(gl->extensions, "EGL_KHR_image_base") ||
        !strstr(gl->extensions, "GL_OES_EGL_image") ||
        !(gl->mpgl_caps & MPGL_CAP_TEX_RG))
        return -1;

    // EGL_KHR_image_base
    p->CreateImageKHR = (void *)eglGetProcAddress("eglCreateImageKHR");
    p->DestroyImageKHR = (void *)eglGetProcAddress("eglDestroyImageKHR");
    // GL_OES_EGL_image
    p->EGLImageTargetTexture2DOES =
        (void *)eglGetProcAddress("glEGLImageTargetTexture2DOES");

    if (!p->CreateImageKHR || !p->DestroyImageKHR ||
        !p->EGLImageTargetTexture2DOES)
        return -1;

    p->display = create_native_va_display(gl);
    if (!p->display)
        return -1;

    p->ctx = va_initialize(p->display, p->log, true);
    if (!p->ctx) {
        vaTerminate(p->display);
        return -1;
    }

    if (hw->reject_emulated && va_guess_if_emulated(p->ctx)) {
        destroy(hw);
        return -1;
    }

    MP_VERBOSE(p, "using VAAPI EGL interop\n");

    insane_hack(hw);
    if (!test_format(hw)) {
        destroy(hw);
        return -1;
    }

    hw->hwctx = &p->ctx->hwctx;
    return 0;
}
void
piglit_init(int argc, char **argv)
{
	bool pass = true;
	unsigned int i;

	piglit_require_extension("GL_ARB_uniform_buffer_object");
	piglit_require_GLSL_version(140);

	printf("%-20s %10s %10s %10s\n",
	       "type", "row_major", "DATA_SIZE", "expected");

	for (i = 0; uniform_types[i].type; i++) {
		pass = test_format(&uniform_types[i], false) && pass;
		pass = test_format(&uniform_types[i], true) && pass;
	}

	piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
}
enum piglit_result
piglit_display(void)
{
    int f;
    GLboolean pass = GL_TRUE;

    for (f = 0; f < ARRAY_SIZE(Formats); f++)
        if (!test_format(&Formats[f]))
            pass = GL_FALSE;

    return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
Beispiel #8
0
enum piglit_result
piglit_display(void)
{
	int f, i;

	for (f = 0; f < ARRAY_SIZE(Formats); f++) {
		for (i = 0; i < 5; i++) {
			if (!test_format(&Formats[f]))
				return PIGLIT_FAIL;
		}
	}

	return PIGLIT_PASS;
}
Beispiel #9
0
int main(int argc, char **argv)
{
	test_newFrame();
	test_newframe_invalid();
	//print_format();
	test_format();
	test_dataLength();

	MQRspec_clearCache();

	report();

	return 0;
}
Beispiel #10
0
int
main(int argc, char *argv[])
{
    uint8_t data[sizeof(UUID)] = {};
    struct crypt_device *cd = NULL;
    luksmeta_uuid_t uuid = {};
    uint32_t offset = 0;
    uint32_t length = 0;
    int r;

    crypt_free(test_format());
    cd = test_init();
    test_hole(cd, &offset, &length);

    r = luksmeta_save(cd, CRYPT_ANY_SLOT, UUID, UUID, sizeof(UUID));
    if (r < 0)
        error(EXIT_FAILURE, -r, "%s:%d", __FILE__, __LINE__);

    /* Test the layout state. */
    assert(test_layout((range_t[]) {
        { 0, 1024 },                   /* LUKS header */
        { 1024, 3072, true },          /* Keyslot Area */
        { offset, 4096 },              /* luksmeta header */
        { offset + 4096, 4096 },       /* luksmeta slot 0 */
        END(offset + 8192),            /* Rest of the file */
    }));

    assert(luksmeta_load(cd, r, uuid, data, sizeof(data)) == sizeof(data));
    assert(memcmp(uuid, UUID, sizeof(UUID)) == 0);
    assert(memcmp(data, UUID, sizeof(UUID)) == 0);
    assert(luksmeta_save(cd, r, UUID, UUID, sizeof(UUID)) == -EALREADY);
    assert(luksmeta_wipe(cd, r, (luksmeta_uuid_t) {}) == -EKEYREJECTED);
    assert(luksmeta_wipe(cd, r, (luksmeta_uuid_t) { 1 }) == -EKEYREJECTED);
    assert(luksmeta_wipe(cd, r, UUID) == 0);
    assert(luksmeta_wipe(cd, r, UUID) == -EALREADY);
    assert(luksmeta_wipe(cd, r, (luksmeta_uuid_t) {}) == -EALREADY);

    /* Test the layout state. */
    assert(test_layout((range_t[]) {
        { 0, 1024 },                   /* LUKS header */
        { 1024, 3072, true },          /* Keyslot Area */
        { offset, 4096 },              /* luksmeta header */
        END(offset + 4096),            /* Rest of the file */
    }));

    crypt_free(cd);
    unlink(filename);
    return 0;
}
Beispiel #11
0
int main(int argc, char** argv)
{
	printf("OPERATION    TESTS\n");
	printf("==================\n\n");

	init (argc, argv);

	test_search();
	test_cmpOrder();
	test_format();

	printf("\ntest_operation RESULTS: %d test(s) done. %d error(s).\n", nbTest, nbError);

	return nbError;
}
Beispiel #12
0
enum piglit_result
piglit_display(void)
{
	bool pass = true;

	pass = test_format(GL_RGB) && pass;
	pass = test_format(GL_RGB4) && pass;
	pass = test_format(GL_RGB5) && pass;
	pass = test_format(GL_RGB8) && pass;
	pass = test_format(GL_RGB10) && pass;
	pass = test_format(GL_RGB12) && pass;
	pass = test_format(GL_RGB16) && pass;

	if (piglit_is_extension_supported("GL_ARB_ES2_compatibility")) {
		pass = test_format(GL_RGB565) && pass;
	}

	if (piglit_is_extension_supported("GL_EXT_texture_sRGB")) {
		pass = test_format(GL_SRGB) && pass;
		pass = test_format(GL_SRGB8) && pass;
	}

	return pass ? PIGLIT_PASS : PIGLIT_FAIL;
}
Beispiel #13
0
void ch3()
{
	printf("======ch3()\n");
	for_getchar();
    password();
	p_71_2();
	lf_test();
    //area1();
	//guide_p33();
	guide_p154();
	test_format(); 
	test_getche();
	return_scanf();
	
}
Beispiel #14
0
int main(int argc, char **argv)
{
	test_eccTable();
	test_eccTable2();
	//print_eccTable();
	test_newframe();
	test_newframe_invalid();
	//test_alignment();
	test_verpat();
	//print_newFrame();
	test_format();

	report();

	return 0;
}
Beispiel #15
0
PIGLIT_GL_TEST_CONFIG_END

void
piglit_init(int argc, char **argv)
{
	bool pass;

	piglit_require_extension("GL_ARB_texture_stencil8");

	pass = test_format(GL_STENCIL_INDEX8,
			   GL_STENCIL_INDEX,
			   GL_UNSIGNED_BYTE,
			   1);

	piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
}
void
piglit_init(int argc, char **argv)
{
	bool pass = true;
	unsigned int i;

	piglit_require_extension("GL_ARB_uniform_buffer_object");
	piglit_require_GLSL_version(140);

	printf("%-20s %20s %20s\n", "type", "GL_UNIFORM_TYPE", "expected");
	printf("--------------------------------------------------------------\n");
	for (i = 0; uniform_types[i].type; i++) {
		pass = test_format(&uniform_types[i]) && pass;
	}

	piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
}
Beispiel #17
0
void test_alignments(test_harness& t) {
    sam::alignment aln;

    t.check(sizeof aln, sizeof(void*), "aln.sizeof");

    sam::alignment a1(aln);
    sam::alignment a2 = aln;

    a2 = a1;

    a1.set_qname("JAS5_12:1:3");

    test_unpack_seq(t);
    test_iterators(t, a1);
    test_auxen(t);

    test_format(t);
}
Beispiel #18
0
int main(void)
{
	//print_masks();
	test_masks();
	test_eval();
	test_eval2();
	test_eval3();
	test_format();
	test_calcN2();
	test_calcRunLength();
	test_calcN1N3();

	report();

	QRspec_clearCache();

	return 0;
}
Beispiel #19
0
enum piglit_result
piglit_display(void)
{
	glEnableVertexAttribArray(0);
	glEnableVertexAttribArray(1);

	glActiveTexture(GL_TEXTURE0);

	glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float),
			      vertex_data);
	glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 4 * sizeof(float),
			      (void*) (vertex_data + (2 * sizeof(float))));

	bool pass = true;

	struct fmt_test *test = tests;
	/* Toggle 'req_rend' for EXT_render_snorm compatible formats. */
	if (piglit_is_extension_supported("GL_EXT_render_snorm")) {
		for (unsigned i = 0; i < ARRAY_SIZE(tests); i++, test++) {
			switch (test->iformat) {
			case GL_R16_SNORM_EXT:
			case GL_RG16_SNORM_EXT:
			case GL_RGBA16_SNORM_EXT:
				test->req_render = true;
				test->can_read = true;
			}
		}
	}

	/* Loop over each format. */
	test = tests;
	for (unsigned i = 0; i < ARRAY_SIZE(tests); i++, test++) {
		bool fmt_pass = test_format(test);
		piglit_report_subtest_result(PIGLIT_RESULT(fmt_pass),
					     "format 0x%x",
					     test->iformat);
		pass &= fmt_pass;
	}

	if (!piglit_check_gl_error(GL_NO_ERROR))
		piglit_report_result(PIGLIT_FAIL);

	return PIGLIT_RESULT(pass);
}
Beispiel #20
0
enum piglit_result
piglit_display(void)
{
    enum piglit_result result = PIGLIT_SKIP;
    int i;

    glClearColor(0.5, 0.5, 0.5, 0.5);
    glClear(GL_COLOR_BUFFER_BIT);

    y_index = 0;

    for (i = 0; i < ARRAY_SIZE(formats); i++) {
        piglit_merge_result(&result, test_format(i));
    }

    piglit_present_results();

    return result;
}
Beispiel #21
0
int main(int argc, char **argv)
{
	test_iterate();
	test_iterate2();
	//print_filler();
	test_filler();
	test_format();
	test_encode();
	test_encode2();
	test_encode3();
	test_encodeNull();
	test_encodeEmpty();
	test_encodeNull8();
	test_encodeEmpty8();
	test_encodeLongData();
	test_01234567();
	test_invalid_input();
//	print_01234567();
	test_struct_example();
	test_struct_semilong();
	test_null_free();
	test_qrraw_new();
	test_mqrraw_new();
	test_encodeData();
	test_formatInfo();
	test_decodeSimple();
	test_decodeLong();
	test_decodeVeryLong();
	//print_fillerMQR();
	test_fillerMQR();
	test_formatInfoMQR();
	test_encodeTooLongMQR();
	test_decodeShortMQR();
	test_oddBitCalcMQR();
	test_mqrencode();
	test_apiversion();

	report();

	return 0;
}
Beispiel #22
0
int main(int argc, char *argv[])
{
	(void)argc, (void)argv;

	if(!test_bitbuffer())
		return 1;

	if(!test_format())
		return 1;

	if(!test_encoders())
		return 1;

	if(!test_decoders())
		return 1;

	if(!test_metadata())
		return 1;

	return 0;
}
static void test_connector(const char *test_name,
			   struct kmstest_connector_config *cconf,
			   enum test_flags flags)
{
	const uint32_t *formats;
	int format_count;
	int i;

	igt_get_all_formats(&formats, &format_count);
	for (i = 0; i < format_count; i++) {
		if (intel_gen(intel_get_drm_devid(drm_fd)) < 4
		    && formats[i] == DRM_FORMAT_XRGB2101010) {
			igt_info("gen2/3 don't support 10bpc, skipping\n");
			continue;
		}

		test_format(test_name,
			    cconf, &cconf->connector->modes[0],
			    formats[i], flags);
	}
}
Beispiel #24
0
int main(void)
{
	test_iterate();
	test_iterate2();
	//print_filler();
	test_filler();
	test_format();
	test_encode();
	test_encode2();
	test_encode3();
	test_encodeNull();
	test_encodeEmpty();
	test_encodeNull8();
	test_encodeEmpty8();
	test_encodeTooLong();
	test_01234567();
	test_invalid_input();
//	print_01234567();
	test_struct_example();
	test_struct_semilong();
	test_null_free();
	test_qrraw_new();
	test_mqrraw_new();
	test_encodeData();
	test_formatInfo();
	test_decodeSimple();
	test_decodeLong();
	test_decodeVeryLong();
	//print_fillerMQR();
	test_fillerMQR();
	test_formatInfoMQR();
	test_encodeTooLongMQR();
	test_decodeShortMQR();

	QRcode_clearCache();

	report();

	return 0;
}
Beispiel #25
0
int main(void)
{
	if(!test_md5())
		return 1;

	if(!test_bitwriter())
		return 1;

	if(!test_format())
		return 1;

	if(!test_encoders())
		return 1;

	if(!test_decoders())
		return 1;

	if(!test_metadata())
		return 1;

	return 0;
}
Beispiel #26
0
/**
 * Test all formats in texsubimage_test_sets[] for the given
 * texture target.
 */
static GLboolean
test_formats(GLenum target)
{
	GLboolean pass = GL_TRUE;
	int i, j;

	/* loop over the format groups */
	for (i = 0; i < ARRAY_SIZE(texsubimage_test_sets); i++) {
		const struct test_desc *set = &texsubimage_test_sets[i];
		GLboolean skip = GL_FALSE;

		/* only test compressed formats with 2D textures */
		if (i > 0 && target != GL_TEXTURE_2D)
			continue;

		/* skip formats for unsupported extensions */
		for (j = 0; j < ARRAY_SIZE(set->ext); j++) {
			if (set->ext[j] &&
			    !piglit_is_extension_supported(set->ext[j])) {
				/* req'd extension not supported */
				skip = GL_TRUE;
				break;
			}
		}
		if (skip)
			continue;

		/* loop over formats in the set */
		for (j = 0; j < set->num_formats; j++) {
			if (!test_format(target,
					 set->format[j].internalformat)) {
				pass = GL_FALSE;
			}
		}
	}

	return pass;
}
void CommonTestsSuite::Run() {
	test_Endianess();
	test_isNumeric();
	test_lowerCase();
	test_upperCase();
	test_ltrim();
	test_rtrim();
	test_trim();
	test_replace();
	test_split();
	test_mapping();
	test_format();
	test_splitFileName();
	test_generateRandomString();
	test_GetHostByName();
	test_md5();
	test_HMACsha256();
	test_b64();
	test_unb64();
	test_unhex();
	test_ParseURL();
	test_setFdOptions();
}
Beispiel #28
0
int main()
{
	plan(16);

	test_uints();
	test_ints();
	test_bools();
	test_floats();
	test_doubles();
	test_nils();
	test_strls();
	test_binls();
	test_strs();
	test_bins();
	test_arrays();
	test_maps();
	test_next_on_arrays();
	test_next_on_maps();
	test_compare_uints();
	test_format();

	return check_plan();
}
Beispiel #29
0
void
piglit_init(int argc, char **argv)
{
	GLuint tex;
	int i, texf;
	enum piglit_result result = PIGLIT_SKIP;

	/* Note: We test later extensions by testing them against all
	 * combinations of (storage format, read format) including the
	 * formats from previous extensions.
	 */
	for (i = 1; i < argc; i++) {
		if (strcmp(argv[i], "GL_ARB_texture_rg") == 0) {
			piglit_require_extension(argv[i]);
			test_rg = true;
		} else if (strcmp(argv[i], "GL_ARB_texture_rgb10_a2ui") == 0) {
			piglit_require_extension(argv[i]);
			test_rg = true;
			test_rgb10_a2ui = true;
		} else {
			usage();
			exit(1);
		}
	}

	piglit_require_extension("GL_EXT_texture_integer");

	glGenTextures(1, &tex);
	glBindTexture(GL_TEXTURE_2D, tex);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);

	for (texf = 0; texf < ARRAY_SIZE(formats); texf++)
		piglit_merge_result(&result, test_format(&formats[texf]));

	piglit_report_result(result);
}
Beispiel #30
0
enum piglit_result
piglit_display(void)
{
	enum piglit_result result = PIGLIT_SKIP;
	int i;
	GLuint vao, vbo;

	glClearColor(0.5, 0.5, 0.5, 0.5);
	glClear(GL_COLOR_BUFFER_BIT);

	y_index = 0;

	/* For GL core, we need to have a vertex array object bound.
	 * Otherwise, we don't particularly have to.  Always use a
	 * vertex buffer object, though.
	 */
	glGenBuffers(1, &vbo);
	glBindBuffer(GL_ARRAY_BUFFER_ARB, vbo);
	if (piglit_get_gl_version() >= 31) {
		GLuint vao;
		glGenVertexArrays(1, &vao);
		glBindVertexArray(vao);
	}
	glVertexAttribPointer(vertex_location, 2, GL_FLOAT, GL_FALSE, 0, 0);
	glEnableVertexAttribArray(vertex_location);

	for (i = 0; i < ARRAY_SIZE(formats); i++) {
		piglit_merge_result(&result, test_format(i));
	}

	glDeleteBuffers(1, &vbo);
	glDeleteVertexArrays(1, &vao);

	piglit_present_results();

	return result;
}