diff options
author | Leo Howell <leo@lwh.jp> | 2009-09-05 09:33:22 +0900 |
---|---|---|
committer | Leo Howell <leo@lwh.jp> | 2009-09-05 09:33:22 +0900 |
commit | ef01767c732629b7eff7d1601e76a1bac58f5bfd (patch) | |
tree | ac29871fd3c6f1bab8dc8e3c51e33292d5544a96 /lpg/libqr/test.c | |
download | pdf-simple-sign-ef01767c732629b7eff7d1601e76a1bac58f5bfd.tar.gz pdf-simple-sign-ef01767c732629b7eff7d1601e76a1bac58f5bfd.tar.xz pdf-simple-sign-ef01767c732629b7eff7d1601e76a1bac58f5bfd.zip |
The story so far
Diffstat (limited to 'lpg/libqr/test.c')
-rw-r--r-- | lpg/libqr/test.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/lpg/libqr/test.c b/lpg/libqr/test.c new file mode 100644 index 0000000..76d0b97 --- /dev/null +++ b/lpg/libqr/test.c @@ -0,0 +1,37 @@ +#include <stdio.h> +#include <string.h> +#include <assert.h> +#include <qr/code.h> +#include <qr/data.h> + +#include "bitstream.h" + +int main() { + + struct qr_code * code; + struct qr_data * data; + enum qr_data_type type; + char *str; + size_t len; + + type = QR_DATA_NUMERIC; + str = "01234567"; + len = strlen(str); + + data = qr_create_data(1, type, str, len); + assert(data); + assert(qr_get_data_type(data) == type); + assert(qr_get_data_length(data) == len); + + type = qr_parse_data(data, &str, &len); + printf("[%d] %d\n", type, (int)len); + printf("\"%s\"\n", str); + + code = qr_code_create(QR_EC_LEVEL_M, data); + assert(code); + + printf("Code width %d\n", qr_code_width(code)); + + return 0; +} + |