anchor.diff:  %% @version $Id$
   -module(tester_value_creator).
   -author('schuett@zib.de').
  --vsn('$Id$').
  +-vsn('$Id$ ').
   
   -include("unittest.hrl").
   -include("tester.hrl").
  
positive.code:     end.
  
  -spec create_value_(type_spec(), non_neg_integer(), tester_parse_state:state()) -> term().
  create_value_({product, []}, _Size, _ParseState) ->
      [];
  create_value_({product, Types}, Size, ParseState) ->
      NewSize = erlang:max(1, (Size - length(Types)) div length(Types)),
      [create_value(Type, NewSize, ParseState) || Type <- Types];
  create_value_({tuple, Types}, Size, ParseState) when is_list(Types) ->
      case Types of
          [] ->
              {};
          _ ->
              NewSize = erlang:max(1, (Size - length(Types)) div length(Types)),
              Values = [create_value(Type, NewSize, ParseState) || Type <- Types],
              erlang:list_to_tuple(Values)
      end;
  create_value_({tuple, {typedef, tester, test_any}}, Size, ParseState) ->
      Values = create_value({list, {typedef, tester, test_any}}, Size, ParseState),
      erlang:list_to_tuple(Values);
  create_value_({list, Type}, Size, ParseState) ->
      ListLength = erlang:min(Size, crypto:rand_uniform(list_length_min(),
                                                 list_length_max() + 1)),
      case ListLength of
          0 ->
              [];
          _ ->
              NewSize = erlang:max(1, (Size - ListLength) div ListLength),
              [create_value(Type, NewSize, ParseState) || _ <- lists:seq(1, ListLength)]
      end;
  create_value_({nonempty_list, Type}, Size, ParseState) ->
      ListLength =
          erlang:max(1, erlang:min(Size,
                                   crypto:rand_uniform(1, list_length_max() + 1))),
      NewSize = erlang:max(1, (Size - ListLength) div ListLength),
      [create_value(Type, NewSize, ParseState) || _ <- lists:seq(1, ListLength)];
  create_value_(nonempty_string, Size, ParseState) ->
      RandStringFun =
          fun() ->
                  ListLength0 = crypto:rand_uniform(list_length_min(),
                                                    list_length_max() + 1),
                  ListLength = erlang:max(1, erlang:min(Size, ListLength0)),
                  Type = {range, {integer, 0}, {integer, 16#10ffff}},
                  NewSize = erlang:max(1, (Size - ListLength) div ListLength),
                  [create_value(Type, NewSize, ParseState) || _ <- lists:seq(1, ListLength)]
          end,
      create_val_50rand_50coll(
        ParseState, fun tester_parse_state:get_non_empty_strings/1,
        RandStringFun);
  create_value_(integer, _Size, ParseState) ->
      create_val_50rand_50coll(
        ParseState, fun tester_parse_state:get_integers/1,
        fun() -> crypto:rand_uniform(integer_min(), integer_max() + 1) end);
  % 1..
  create_value_(pos_integer, _Size, ParseState) ->
      create_val_50rand_50coll(
        ParseState, fun tester_parse_state:get_pos_integers/1,
        fun() -> crypto:rand_uniform(1, integer_max() + 1) end);
  % 0..
  create_value_(non_neg_integer, _Size, ParseState) ->
      create_val_50rand_50coll(
        ParseState, fun tester_parse_state:get_non_neg_integers/1,
        fun() -> crypto:rand_uniform(0, integer_max() + 1) end);
  create_value_({integer, Value}, _Size, _ParseState) ->
      Value;
  create_value_({atom, Value}, _Size, _ParseState) ->
      Value;
  create_value_(binary, Size, ParseState) ->
  
negative.code:     case crypto:rand_uniform(0, 2) of
          0 -> false;
          1 -> true
      end;
  create_value_({builtin_type, array}, Size, ParseState) ->
      L = create_value({list,
  