aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/cases/uadd_overflow.ll25
-rw-r--r--tests/cases/uadd_overflow.txt1
-rw-r--r--tests/cube2hash/Makefile14
-rw-r--r--tests/cube2hash/cube2crypto.c23
-rw-r--r--tests/cube2hash/cube2crypto.h9
-rw-r--r--tests/cube2hash/hashstring.cpp28
-rw-r--r--tests/cube2hash/tiger.c175
-rw-r--r--tests/cube2hash/tiger.h12
-rw-r--r--tests/cube2hash/util.h22
-rw-r--r--tests/freetype/main_2.c135
-rw-r--r--tests/freetype/main_3.c184
-rw-r--r--tests/freetype/ref_2.txt33
-rw-r--r--tests/freetype/ref_3.txt33
-rw-r--r--tests/freetype/ref_4.txt32
-rw-r--r--tests/gl/LICENSE.TXT11
-rw-r--r--tests/gl/sdl_ogl.c202
-rw-r--r--tests/gl/tutorial2.frag11
-rw-r--r--tests/gl/tutorial2.vert19
-rw-r--r--tests/glbook/CH02_HelloTriangle.pngbin0 -> 1009 bytes
-rw-r--r--tests/glbook/Chapter_10/MultiTexture/MultiTexture.c213
-rw-r--r--tests/glbook/Chapter_10/MultiTexture/basemap.tgabin0 -> 786476 bytes
-rw-r--r--tests/glbook/Chapter_10/MultiTexture/lightmap.tgabin0 -> 196626 bytes
-rw-r--r--tests/glbook/Chapter_11/Multisample/Multisample.c302
-rw-r--r--tests/glbook/Chapter_11/Stencil_Test/Stencil_Test.c273
-rw-r--r--tests/glbook/Chapter_13/ParticleSystem/ParticleSystem.c294
-rw-r--r--tests/glbook/Chapter_13/ParticleSystem/smoke.tgabin0 -> 49170 bytes
-rw-r--r--tests/glbook/Chapter_15/Hello_Triangle_KD/Hello_Triangle_KD.c306
-rw-r--r--tests/glbook/Chapter_2/Hello_Triangle/Hello_Triangle.c200
-rw-r--r--tests/glbook/Chapter_8/Simple_VertexShader/Simple_VertexShader.c196
-rw-r--r--tests/glbook/Chapter_9/MipMap2D/MipMap2D.c348
-rw-r--r--tests/glbook/Chapter_9/Simple_Texture2D/Simple_Texture2D.c199
-rw-r--r--tests/glbook/Chapter_9/Simple_TextureCubemap/Simple_TextureCubemap.c227
-rw-r--r--tests/glbook/Chapter_9/TextureWrap/TextureWrap.c257
-rw-r--r--tests/glbook/Common/esShader.c155
-rw-r--r--tests/glbook/Common/esShapes.c280
-rw-r--r--tests/glbook/Common/esTransform.c213
-rw-r--r--tests/glbook/Common/esUtil.c420
-rw-r--r--tests/glbook/Common/esUtil.h281
-rw-r--r--tests/glbook/Makefile60
-rw-r--r--tests/glbook/README.linux32
-rw-r--r--tests/hello_world_sdl.cpp4
-rw-r--r--tests/i64_precise.txt128
-rwxr-xr-xtests/runner.py704
-rw-r--r--tests/sdl_audio.c50
-rw-r--r--tests/sounds/LICENSE.txt19
-rw-r--r--tests/sounds/alarmcreatemiltaryfoot_1.wavbin0 -> 443856 bytes
-rw-r--r--tests/sounds/alarmvictory_1.oggbin0 -> 56490 bytes
47 files changed, 5634 insertions, 496 deletions
diff --git a/tests/cases/uadd_overflow.ll b/tests/cases/uadd_overflow.ll
new file mode 100644
index 00000000..a808b9de
--- /dev/null
+++ b/tests/cases/uadd_overflow.ll
@@ -0,0 +1,25 @@
+; ModuleID = 'tests/hello_world.bc'
+target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32-S128"
+target triple = "i386-pc-linux-gnu"
+
+@.str2 = private constant [9 x i8] c"*%d,%d*\0A\00", align 1 ; [#uses=1]
+
+; [#uses=0]
+define i32 @main() {
+entry:
+ %retval = alloca i32, align 4 ; [#uses=1 type=i32*]
+ %mul7 = bitcast i32 -259741926 to i32
+ %shl10 = shl i32 4014, 16
+ %uadd1 = tail call { i32, i1 } @llvm.uadd.with.overflow.i32(i32 %mul7, i32 %shl10)
+ %a0 = extractvalue { i32, i1 } %uadd1, 0
+ %a1 = extractvalue { i32, i1 } %uadd1, 1
+ %a2 = zext i1 %a1 to i32
+ call i32 (i8*, ...)* @printf(i8* getelementptr inbounds ([9 x i8]* @.str2, i32 0, i32 0), i32 %a0, i32 %a2) ; [#uses=0]
+ ret i32 1
+}
+
+; [#uses=1]
+declare i32 @printf(i8*, ...)
+
+declare { i32, i1 } @llvm.uadd.with.overflow.i32(i32, i32) nounwind readnone
+
diff --git a/tests/cases/uadd_overflow.txt b/tests/cases/uadd_overflow.txt
new file mode 100644
index 00000000..dcda9240
--- /dev/null
+++ b/tests/cases/uadd_overflow.txt
@@ -0,0 +1 @@
+*3319578,1*
diff --git a/tests/cube2hash/Makefile b/tests/cube2hash/Makefile
new file mode 100644
index 00000000..5d0a7a63
--- /dev/null
+++ b/tests/cube2hash/Makefile
@@ -0,0 +1,14 @@
+all: cube2hash.bc
+
+cube2hash.bc: cube2crypto.o tiger.o hashstring.o
+ $(CXX) $^ -o $@
+
+hashstring.o: hashstring.cpp
+ $(CXX) -c $^ -o $@
+
+cube2crypto.o: cube2crypto.c cube2crypto.h
+ $(CC) -c $< -o $@
+
+tiger.o: tiger.c tiger.h
+ $(CC) -c $< -o $@
+
diff --git a/tests/cube2hash/cube2crypto.c b/tests/cube2hash/cube2crypto.c
new file mode 100644
index 00000000..52613318
--- /dev/null
+++ b/tests/cube2hash/cube2crypto.c
@@ -0,0 +1,23 @@
+#include <stdlib.h>
+#include "util.h"
+#include "tiger.h"
+#include "cube2crypto.h"
+
+char *cube2crypto_hashstring(char *string)
+{
+ char *result = (char *)malloc(49);
+ union hashval hv;
+
+ tiger_hash((uchar *)string, strlen(string), &hv);
+
+ int i;
+ for(i = 0; i < sizeof(hv.bytes); i++)
+ {
+ uchar c = hv.bytes[i];
+ *(result+(i*2)) = "0123456789ABCDEF"[c&0xF];
+ *(result+(i*2)+1) = "0123456789ABCDEF"[c>>4];
+ }
+ *(result+(i*2)+2) = '\0';
+
+ return result;
+}
diff --git a/tests/cube2hash/cube2crypto.h b/tests/cube2hash/cube2crypto.h
new file mode 100644
index 00000000..90bd06a8
--- /dev/null
+++ b/tests/cube2hash/cube2crypto.h
@@ -0,0 +1,9 @@
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+char *cube2crypto_hashstring(char *string);
+
+#ifdef __cplusplus
+} /* closing brace for extern "C" */
+#endif \ No newline at end of file
diff --git a/tests/cube2hash/hashstring.cpp b/tests/cube2hash/hashstring.cpp
new file mode 100644
index 00000000..b08d5d5e
--- /dev/null
+++ b/tests/cube2hash/hashstring.cpp
@@ -0,0 +1,28 @@
+#include "cube2crypto.h"
+#include <stdlib.h>
+#include <stdio.h>
+
+#define EXIT_FAILURE 1
+#define EXIT_SUCCESS 0
+
+void help()
+{
+ printf("Usage: hashstring <seed>\n");
+}
+
+int main(int argc, char **argv)
+{
+ if(argc != 2 || !argv[1])
+ {
+ help();
+ return EXIT_FAILURE;
+ }
+
+ char *answer = cube2crypto_hashstring(argv[1]);
+
+ printf("hash value: %s\n", answer);
+
+ free(answer);
+
+ return EXIT_SUCCESS;
+}
diff --git a/tests/cube2hash/tiger.c b/tests/cube2hash/tiger.c
new file mode 100644
index 00000000..f8707248
--- /dev/null
+++ b/tests/cube2hash/tiger.c
@@ -0,0 +1,175 @@
+///////////////////////// cryptography /////////////////////////////////
+
+/* Based off the reference implementation of Tiger, a cryptographically
+ * secure 192 bit hash function by Ross Anderson and Eli Biham. More info at:
+ * http://www.cs.technion.ac.il/~biham/Reports/Tiger/
+ */
+
+#define TIGER_PASSES 3
+
+#include "tiger.h"
+#include "util.h"
+
+chunk sboxes[4*256];
+
+#define sb1 (sboxes)
+#define sb2 (sboxes+256)
+#define sb3 (sboxes+256*2)
+#define sb4 (sboxes+256*3)
+
+#define round(a, b, c, x) \
+ c ^= x; \
+ a -= sb1[((c)>>(0*8))&0xFF] ^ sb2[((c)>>(2*8))&0xFF] ^ \
+ sb3[((c)>>(4*8))&0xFF] ^ sb4[((c)>>(6*8))&0xFF] ; \
+ b += sb4[((c)>>(1*8))&0xFF] ^ sb3[((c)>>(3*8))&0xFF] ^ \
+ sb2[((c)>>(5*8))&0xFF] ^ sb1[((c)>>(7*8))&0xFF] ; \
+ b *= mul;
+
+void tiger_compress(const chunk *str, chunk state[3])
+{
+ chunk a, b, c;
+ chunk aa, bb, cc;
+ chunk x0, x1, x2, x3, x4, x5, x6, x7;
+
+ a = state[0];
+ b = state[1];
+ c = state[2];
+
+ x0=str[0]; x1=str[1]; x2=str[2]; x3=str[3];
+ x4=str[4]; x5=str[5]; x6=str[6]; x7=str[7];
+
+ aa = a;
+ bb = b;
+ cc = c;
+
+ int pass;
+
+ for(pass = 0; pass < TIGER_PASSES; pass++)
+ {
+ if(pass)
+ {
+ x0 -= x7 ^ 0xA5A5A5A5A5A5A5A5ULL; x1 ^= x0; x2 += x1; x3 -= x2 ^ ((~x1)<<19);
+ x4 ^= x3; x5 += x4; x6 -= x5 ^ ((~x4)>>23); x7 ^= x6;
+ x0 += x7; x1 -= x0 ^ ((~x7)<<19); x2 ^= x1; x3 += x2;
+ x4 -= x3 ^ ((~x2)>>23); x5 ^= x4; x6 += x5; x7 -= x6 ^ 0x0123456789ABCDEFULL;
+ }
+
+ uint mul = !pass ? 5 : (pass==1 ? 7 : 9);
+ round(a, b, c, x0) round(b, c, a, x1) round(c, a, b, x2) round(a, b, c, x3)
+ round(b, c, a, x4) round(c, a, b, x5) round(a, b, c, x6) round(b, c, a, x7)
+
+ chunk tmp = a; a = c; c = b; b = tmp;
+
+ }
+
+ a ^= aa;
+ b -= bb;
+ c += cc;
+
+ state[0] = a;
+ state[1] = b;
+ state[2] = c;
+}
+
+void tiger_gensboxes()
+{
+ const char *str = "Tiger - A Fast New Hash Function, by Ross Anderson and Eli Biham";
+ chunk state[3] = { 0x0123456789ABCDEFULL, 0xFEDCBA9876543210ULL, 0xF096A5B4C3B2E187ULL };
+ uchar temp[64];
+ int i, j, col, sb, pass;
+
+ if(BIGENDIAN)
+ {
+ for(j = 0; j < 64; j++)
+ {
+ temp[j^7] = str[j];
+ }
+ }
+ else
+ {
+ for(j = 0; j < 64; j++)
+ {
+ temp[j] = str[j];
+ }
+ }
+
+ for(i = 0; i < 1024; i++)
+ {
+ for(col = 0; col < 8; col++)
+ {
+ ((uchar *)&sboxes[i])[col] = i&0xFF;
+ }
+ }
+
+ int abc = 2;
+ for(pass = 0; pass < 5; pass++)
+ {
+ for(i = 0; i < 256; i++)
+ {
+ for(sb = 0; sb < 1024; sb += 256)
+ {
+ abc++;
+ if(abc >= 3) { abc = 0; tiger_compress((chunk *)temp, state); }
+ for(col = 0; col < 8; col++)
+ {
+ uchar val = ((uchar *)&sboxes[sb+i])[col];
+ ((uchar *)&sboxes[sb+i])[col] = ((uchar *)&sboxes[sb + ((uchar *)&state[abc])[col]])[col];
+ ((uchar *)&sboxes[sb + ((uchar *)&state[abc])[col]])[col] = val;
+ }
+ }
+ }
+ }
+}
+
+void tiger_hash(const uchar *str, int length, union hashval *val)
+{
+ static int init = false;
+ if(!init) { tiger_gensboxes(); init = true; }
+
+ uchar temp[64];
+
+ val->chunks[0] = 0x0123456789ABCDEFULL;
+ val->chunks[1] = 0xFEDCBA9876543210ULL;
+ val->chunks[2] = 0xF096A5B4C3B2E187ULL;
+
+ int i, j;
+ for(i = length; i >= 64; i -= 64, str += 64)
+ {
+ if(BIGENDIAN)
+ {
+ for(j = 0; j < 64; j++)
+ {
+ temp[j^7] = str[j];
+ }
+
+ tiger_compress((chunk *)temp, val->chunks);
+ }
+ else
+ {
+ tiger_compress((chunk *)str, val->chunks);
+ }
+ }
+
+ if(BIGENDIAN)
+ {
+ for(j = 0; j < i; j++) temp[j^7] = str[j];
+ temp[j^7] = 0x01;
+ while(++j&7) temp[j^7] = 0;
+ }
+ else
+ {
+ for(j = 0; j < i; j++) temp[j] = str[j];
+ temp[j] = 0x01;
+ while(++j&7) temp[j] = 0;
+ }
+
+ if(j > 56)
+ {
+ while(j < 64) temp[j++] = 0;
+ tiger_compress((chunk *)temp, val->chunks);
+ j = 0;
+ }
+ while(j < 56) temp[j++] = 0;
+ *(chunk *)(temp+56) = (chunk)length<<3;
+ tiger_compress((chunk *)temp, val->chunks);
+}
diff --git a/tests/cube2hash/tiger.h b/tests/cube2hash/tiger.h
new file mode 100644
index 00000000..b0d70797
--- /dev/null
+++ b/tests/cube2hash/tiger.h
@@ -0,0 +1,12 @@
+#ifndef _TIGER_H
+#define _TIGER_H
+
+union hashval
+{
+ unsigned char bytes[3*8];
+ unsigned long long int chunks[3];
+};
+
+void tiger_hash(const unsigned char *str, int length, union hashval *val);
+
+#endif
diff --git a/tests/cube2hash/util.h b/tests/cube2hash/util.h
new file mode 100644
index 00000000..844b8ed0
--- /dev/null
+++ b/tests/cube2hash/util.h
@@ -0,0 +1,22 @@
+#ifndef _UTIL_H
+#define _UTIL_H
+
+#include <string.h>
+#include <ctype.h>
+#include <stdlib.h>
+#include <stdio.h>
+
+#define BIGENDIAN 0
+
+#ifndef bool
+#define bool unsigned short int
+#define true 1
+#define false 0
+#endif
+
+typedef unsigned long long int chunk;
+typedef unsigned char uchar;
+typedef unsigned short ushort;
+typedef unsigned int uint;
+
+#endif
diff --git a/tests/freetype/main_2.c b/tests/freetype/main_2.c
new file mode 100644
index 00000000..85e5609d
--- /dev/null
+++ b/tests/freetype/main_2.c
@@ -0,0 +1,135 @@
+/* example1.c */
+/* */
+/* This small program shows how to print a rotated string with the */
+/* FreeType 2 library. */
+
+
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+#include <stdlib.h>
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+
+int WIDTH = 0;
+int HEIGHT = 0;
+
+/* origin is the upper left corner */
+unsigned char *image;
+
+
+/* Replace this function with something useful. */
+
+void
+draw_bitmap( FT_Bitmap* bitmap,
+ FT_Int x,
+ FT_Int y)
+{
+ FT_Int i, j, p, q;
+ FT_Int x_max = x + bitmap->width;
+ FT_Int y_max = y + bitmap->rows;
+
+ for ( i = x, p = 0; i < x_max; i++, p++ )
+ {
+ for ( j = y, q = 0; j < y_max; j++, q++ )
+ {
+ if ( i < 0 || j < 0 ||
+ i >= WIDTH || j >= HEIGHT )
+ continue;
+
+ image[j*WIDTH + i] |= bitmap->buffer[q * bitmap->width + p];
+ }
+ }
+}
+
+
+void
+show_image( void )
+{
+ int i, j;
+ int count = 0;
+
+ for ( i = 0; i < HEIGHT; i++ )
+ {
+ for ( j = 0; j < WIDTH; j++ )
+ {
+ if (image[i*WIDTH + j]) count++;
+ putchar(image[i*WIDTH + j] == 0? ' '
+ : image[i*WIDTH + j] < 128 ? '+'
+ : '*' );
+ }
+ putchar( '\n' );
+ }
+ printf("Non-0s: %d\n", count);
+}
+
+
+int
+main( int argc,
+ char** argv )
+{
+ FT_Library library;
+ FT_Face face;
+
+ FT_GlyphSlot slot;
+ FT_Error error;
+
+ FT_UInt glyphIndex;
+
+ char* filename;
+ char* text;
+
+ int target_height;
+
+ if ( argc != 6 )
+ {
+ fprintf ( stderr, "usage: %s font sample-text width height angle\n", argv[0] );
+ exit( 1 );
+ }
+
+ // Only test the character 'w'
+ text = "w";
+
+ filename = argv[1]; /* first argument */
+ WIDTH = atoi(argv[3]);
+ HEIGHT = atoi(argv[4]);
+ target_height = HEIGHT;
+
+ image = (unsigned char*)malloc(WIDTH*HEIGHT);
+ for (int x = 0; x < WIDTH; x++)
+ for (int y = 0; y < HEIGHT; y++)
+ image[y*WIDTH + x] = 0;
+
+ error = FT_Init_FreeType( &library ); /* initialize library */
+ if (error) printf("Init Error! %d\n", error);
+
+ error = FT_New_Face( library, argv[1], 0, &face ); /* create face object */
+ if (error) printf("New_Face Error! %d\n", error);
+
+ /* use 50pt at 100dpi */
+ error = FT_Set_Char_Size( face, 0, 32 * 64, 0, 0 ); /* set character size */
+ if (error) printf("Set_Cshar_Size Error! %d\n", error);
+
+ slot = face->glyph;
+
+ glyphIndex = FT_Get_Char_Index(face, text[0]);
+
+ /* load glyph image into the slot (erase previous one) */
+ error = FT_Load_Glyph(face, glyphIndex, FT_LOAD_NO_BITMAP);
+ if(error) printf("FT_Load_Glyph Error! %d\n", error);
+
+ error = FT_Render_Glyph(slot, FT_RENDER_MODE_NORMAL);
+ if(error) printf("FT_Render_Glyph Error! %d\n", error);
+
+ /* now, draw to our target surface (convert position) */
+ draw_bitmap(&slot->bitmap, slot->bitmap_left, target_height - slot->bitmap_top);
+
+ show_image();
+
+ FT_Done_Face(face);
+ FT_Done_FreeType(library);
+ return 0;
+}
+
+/* EOF */ \ No newline at end of file
diff --git a/tests/freetype/main_3.c b/tests/freetype/main_3.c
new file mode 100644
index 00000000..c3941a17
--- /dev/null
+++ b/tests/freetype/main_3.c
@@ -0,0 +1,184 @@
+/* example1.c */
+/* */
+/* This small program shows how to print a rotated string with the */
+/* FreeType 2 library. */
+
+
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+#include <stdlib.h>
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+
+
+int WIDTH = 0;
+int HEIGHT = 0;
+
+/* origin is the upper left corner */
+unsigned char *image;
+
+unsigned char pixelData[32 * 32];
+
+/* Replace this function with something useful. */
+void
+draw_bitmap( FT_Bitmap* bitmap,
+ FT_Int x,
+ FT_Int y)
+{
+ FT_Int i, j, p, q;
+ FT_Int x_max = x + bitmap->width;
+ FT_Int y_max = y + bitmap->rows;
+ int xbyte;
+ int xbit;
+ unsigned char* pcur;
+
+ unsigned char* src = bitmap->buffer;
+ unsigned char* dest = pixelData;
+
+ // Note: FT_RENDER_MONO_MODE render characater's one pixel by a single bit,
+ // translate the single bit to a single char for displaying image.
+ for(int _y = 0; _y < bitmap->rows; ++_y)
+ {
+ for(int _x = 0; _x < bitmap->width; ++_x)
+ {
+ xbyte = _x / 8;
+ xbit = _x - xbyte * 8;
+ pcur = dest + _x;
+
+ // test if the pixel bit be set
+ if(src[xbyte] & (0x80 >> xbit))
+ {
+ *pcur = 0xFF;
+ }
+ else
+ {
+ *pcur = 0;
+ }
+ }
+ src += bitmap->pitch;
+ dest += bitmap->width;
+ }
+
+ // display the character to ref txt file
+ for ( i = x, p = 0; i < x_max; i++, p++ )
+ {
+ for ( j = y, q = 0; j < y_max; j++, q++ )
+ {
+ if ( i < 0 || j < 0 ||
+ i >= WIDTH || j >= HEIGHT )
+ continue;
+
+ image[j*WIDTH + i] |= pixelData[q * bitmap->width + p];
+ }
+ }
+}
+
+
+void
+show_image( void )
+{
+ int i, j;
+ int count = 0;
+
+ for ( i = 0; i < HEIGHT; i++ )
+ {
+ for ( j = 0; j < WIDTH; j++ ) {
+ if (image[i*WIDTH + j]) count++;
+ putchar( image[i*WIDTH + j] == 0 ? ' '
+ : image[i*WIDTH + j] < 128 ? '+'
+ : '*');
+ }
+ putchar('\n');
+ }
+ printf("Non-0s: %d\n", count);
+}
+
+
+int
+main( int argc,
+ char** argv )
+{
+ FT_Library library;
+ FT_Face face;
+
+ FT_GlyphSlot slot;
+ FT_Error error;
+ FT_Vector pen; /* untransformed origin */
+
+ char* filename;
+ char* text;
+
+ double angle;
+ int target_height;
+ int n, num_chars;
+ FT_UInt glyphIndex;
+
+ if ( argc != 6 )
+ {
+ fprintf ( stderr, "usage: %s font sample-text width height angle\n", argv[0] );
+ exit( 1 );
+ }
+
+ filename = argv[1]; /* first argument */
+ text = argv[2]; /* second argument */
+ num_chars = strlen( text );
+ WIDTH = atoi(argv[3]);
+ HEIGHT = atoi(argv[4]);
+ angle = ( ((float)atoi(argv[5])) / 360 ) * 3.14159 * 2; /* use 25 degrees */
+ target_height = HEIGHT;
+
+ image = (unsigned char*)malloc(WIDTH*HEIGHT);
+ for (int x = 0; x < WIDTH; x++)
+ for (int y = 0; y < HEIGHT; y++)
+ image[y*WIDTH + x] = 0;
+
+ error = FT_Init_FreeType( &library ); /* initialize library */
+ if (error) printf("Init Error! %d\n", error);
+
+ error = FT_New_Face( library, argv[1], 0, &face ); /* create face object */
+ if (error) printf("New_Face Error! %d\n", error);
+
+ /* use 50pt at 100dpi */
+ error = FT_Set_Char_Size( face, 32 * 64, 0,
+ 0, 0 ); /* set character size */
+ if (error) printf("Set_Char_Size Error! %d\n", error);
+
+ slot = face->glyph;
+ pen.x = 0;
+ pen.y = 0;
+ for ( n = 0; n < num_chars; n++ )
+ {
+ /* set transformation */
+ FT_Set_Transform( face, 0, &pen );
+
+ /* load glyph image into the slot (erase previous one) */
+ glyphIndex = FT_Get_Char_Index(face, text[n]);
+
+ /* load glyph image into the slot (erase previous one) */
+ error = FT_Load_Glyph(face, glyphIndex, FT_LOAD_DEFAULT);
+ if(error) printf("FT_Load_Glyph Error! %d\n", error);
+
+ error = FT_Render_Glyph(slot, FT_RENDER_MODE_MONO);
+ if(error) printf("FT_Render_Glyph Error! %d\n", error);
+
+ /* now, draw to our target surface (convert position) */
+ draw_bitmap(&slot->bitmap,
+ slot->bitmap_left,
+ target_height - slot->bitmap_top );
+
+ /* increment pen position */
+ pen.x += slot->advance.x;
+ pen.y += slot->advance.y;
+ }
+
+ show_image();
+
+ FT_Done_Face ( face );
+ FT_Done_FreeType( library );
+
+ return 0;
+}
+
+/* EOF */
diff --git a/tests/freetype/ref_2.txt b/tests/freetype/ref_2.txt
new file mode 100644
index 00000000..c15bb415
--- /dev/null
+++ b/tests/freetype/ref_2.txt
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+****+ +***** +****
+****+ +*****+ +****
++**** ******+ ****+
++**** ******* ****+
++****+ +***+*** +****
+ ****+ +***+***+ +***+
+ +***+ **** ***+ ****+
+ +**** ***+ +*** ****+
+ +**** +***+ +*** +****
+ ****++*** +***++***+
+ +***+**** ***++***+
+ +***+***+ +*******+
+ *******+ +*******
+ ******* +******+
+ +*****+ ******+
+ +*****+ +*****
+ *****+ +*****
+Non-0s: 285
diff --git a/tests/freetype/ref_3.txt b/tests/freetype/ref_3.txt
new file mode 100644
index 00000000..2b121eb7
--- /dev/null
+++ b/tests/freetype/ref_3.txt
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+
+
+***** ***** ****
+***** ****** *****
+***** ******* *****
+***** ******* ****
+ ***** ******* ****
+ ***** *** **** *****
+ ***** **** **** ****
+ **** **** **** ****
+ ***** **** **** ****
+ ***** **** ***** ****
+ ***** **** **** ****
+ **** **** **** ****
+ **** **** **** ****
+ ***** *** **** ****
+ **** **** **** ****
+ **** **** **** ****
+ **** **** **** ***
+ ******* ********
+ ******* *******
+ ******* *******
+ ******* ******
+ ***** *****
+Non-0s: 342
diff --git a/tests/freetype/ref_4.txt b/tests/freetype/ref_4.txt
new file mode 100644
index 00000000..e