Example #1
0
void test_struct_semilong(void)
{
	QRcode_List *codes, *list;
	const char *str = "asdfasdfasdfasdfasdfASDFASDASDFASDFAsdfasdfasdfasdASDFASDFADSADadsfasdf";
	int num, size;

	testStart("Testing semi-long structured-append symbols");
	codes = QRcode_encodeString8bitStructured(str, 1, QR_ECLEVEL_L);
	list = codes;
	num = 0;
	while(list != NULL) {
		num++;
		assert_equal(list->code->version, 1, "version number is %d (1 expected)\n", list->code->version);
		list = list->next;
	}
	size = QRcode_List_size(codes);
	assert_equal(num, size, "QRcode_List_size returns wrong size?");
	QRcode_List_free(codes);

	codes = QRcode_encodeStringStructured(str, 1, QR_ECLEVEL_L, QR_MODE_8, 1);
	list = codes;
	num = 0;
	while(list != NULL) {
		num++;
		assert_equal(list->code->version, 1, "version number is %d (1 expected)\n", list->code->version);
		list = list->next;
	}
	size = QRcode_List_size(codes);
	assert_equal(num, size, "QRcode_List_size returns wrong size?");
	QRcode_List_free(codes);

	testFinish();
}
Example #2
0
static QRcode_List *encodeStructured(const char *intext)
{
	QRcode_List *list;

	if(eightbit) {
		list = QRcode_encodeString8bitStructured(intext, version, level);
	} else {
		list = QRcode_encodeStringStructured(intext, version, level, hint, casesensitive);
	}

	return list;
}
Example #3
0
void test_struct_example(void)
{
	QRcode_List *codes, *list;
	const char *str = "an example of four Structured Append symbols,";
	int num;

	testStart("Testing the example of structured-append symbols");
	codes = QRcode_encodeString8bitStructured(str, 1, QR_ECLEVEL_M);
	list = codes;
	num = 0;
	while(list != NULL) {
		num++;
		assert_equal(list->code->version, 1, "version number is %d (1 expected)\n", list->code->version);
		list = list->next;
	}
	assert_equal(num, 4, "number of symbols is %d (4 expected).", num);
	testFinish();
	QRcode_List_free(codes);
}