summaryrefslogtreecommitdiff
path: root/conformance/test_gen_rand.c
blob: 9e2a0c3894452712232ce1345ac5bcb3dddd53da (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/* Generate random test data for CapRTL character set. */
/* A sequence of fully random characters. */
/* First command line parameter is the length of test in bytes, default is 10.*/
#include <stdlib.h>
#include <stdio.h>
#include <time.h>

int
main (int argc, char **argv)
{

  int i, j, len;
  char c;

  if (argv[1])
    len = atoi (argv[1]);
  else
    len = 10;
  srand ((int) (time) (NULL));

  for (i = 0; i < len; i++)
    {
      c = rand () % (0x80 - 0x0E) + 0x0E;
      switch (c)
	{
//      case 0x60:              // rule L3 is not implemented in fribidi yet
	case 0x3C:
	case 0x5F:		// used as a escape char
	case 0x13:		// bidiref doesn't work proper with this
	case 0x14:
	case 0x15:
	case 0x16:
	case 0x17:
	case 0x18:
	case 0x19:
	case 0x1A:
	case 0x1B:
	case 0x1C:
	case 0x1D:
	case 0x1E:
	case 0x1F:
	case 0x00:
	  i--;
	  break;
	default:
	  putchar (c);
	}
    }

  printf ("\n");
}