anchor.diff:           versions/1,new_binary_types/1, call_purged_fun_code_gone/1,
   	 call_purged_fun_code_reload/1, call_purged_fun_code_there/1,
            multi_proc_purge/1, t_check_old_code/1,
  -         external_fun/1,get_chunk/1,module_md5/1,make_stub/1,
  -         make_stub_many_funs/1,constant_pools/1,constant_refc_binaries/1,
  +         external_fun/1,get_chunk/1,module_md5/1,
  +         constant_pools/1,constant_refc_binaries/1,
            false_dependency/1,coverage/1,fun_confusion/1,
            t_copy_literals/1, t_copy_literals_frags/1]).
   
  
positive.code:     end.
  
  
  make_stub(Config) when is_list(Config) ->
      catch erlang:purge_module(my_code_test),
      MD5 = erlang:md5(<<>>),
      Arg3 = {[], [], MD5, 0, 0},
  
      Data = proplists:get_value(data_dir, Config),
      File = filename:join(Data, "my_code_test"),
      {ok,my_code_test,Code} = compile:file(File, [binary]),
  
      my_code_test = code:make_stub_module(my_code_test, Code, Arg3),
      true = erlang:delete_module(my_code_test),
      true = erlang:purge_module(my_code_test),
  
      my_code_test = code:make_stub_module(my_code_test, 
                                           make_unaligned_sub_binary(Code),
                                           Arg3),
      true = erlang:delete_module(my_code_test),
      true = erlang:purge_module(my_code_test),
  
      my_code_test = code:make_stub_module(my_code_test, zlib:gzip(Code),
                                           Arg3),
      true = erlang:delete_module(my_code_test),
      true = erlang:purge_module(my_code_test),
  
      %% Should fail.
      {'EXIT',{badarg,_}} =
      (catch code:make_stub_module(my_code_test, <<"bad">>, Arg3)),
      {'EXIT',{badarg,_}} =
      (catch code:make_stub_module(my_code_test,
                                   bit_sized_binary(Code),
                                   Arg3)),
      {'EXIT',{badarg,_}} =
      (catch code:make_stub_module(my_code_test_with_wrong_name,
                                   Code, Arg3)),
      ok.
  
  make_stub_many_funs(Config) when is_list(Config) ->
      catch erlang:purge_module(many_funs),
      MD5 = erlang:md5(<<>>),
      Arg3 = {[], [], MD5, 0, 0},
  
      Data = proplists:get_value(data_dir, Config),
      File = filename:join(Data, "many_funs"),
      {ok,many_funs,Code} = compile:file(File, [binary]),
  
      many_funs = code:make_stub_module(many_funs, Code, Arg3),
      true = erlang:delete_module(many_funs),
      true = erlang:purge_module(many_funs),
      many_funs = code:make_stub_module(many_funs, 
                                        make_unaligned_sub_binary(Code),
                                        Arg3),
      true = erlang:delete_module(many_funs),
      true = erlang:purge_module(many_funs),
  
      %% Should fail.
      {'EXIT',{badarg,_}} =
      (catch code:make_stub_module(many_funs, <<"bad">>, Arg3)),
      {'EXIT',{badarg,_}} =
      (catch code:make_stub_module(many_funs,
                                   bit_sized_binary(Code),
                                   Arg3)),
      ok.
  
  constant_pools(Config) when is_list(Config) ->
      Data = proplists:get_value(data_dir, Config),
      File = filename:join(Data, "literals"),
  
negative.code:     [versions, new_binary_types, call_purged_fun_code_gone,
       call_purged_fun_code_reload, call_purged_fun_code_there,
       multi_proc_purge, t_check_old_code, external_fun, get_chunk,
       module_md5,
       constant_pools, constant_refc_binaries, false_dependency,
       coverage, fun_confusion, t_copy_literals, t_copy_literals_frags].
  
  