aboutsummaryrefslogblamecommitdiffstats
path: root/lib/asn1/test/asn1_SUITE.erl.src
blob: b3ccedaefc0bc966e2a2d650224a3bfba44bb16b (plain) (tree)
1
2
3
4


                   
                                                        

















                                                                         






                                
                            



                                
                              



                               
                           



                        



                                 
                                                    

                                    














                                                         
                                  





                                              
                   




























































































































                                                                   

      






                                                
                         
                                                                 



                         
 
                                     
           
 
                                    
           
 


                                        
 


                                                                  
 




                                                              
 



                                          



                      


















                                                                                

                        






                            


                                  


                                                                     
 

                                                                                                
 


                                                                     
 



                                                                                             
 


                                                                                    
 


                                                                               
 
                                        




                             





                                                                               
 

                                              
 

                                                                    
 

                                                             
 

                                                      

                               









                                              



                              


                                                          
 


                                                                                     
 


                                                          
 


                                                                                  
 


                                                                         
 


                                                                    



                         

                                                     
 

                                                                                
 

                                                     
 

                                                                             
 

                                                                    
 

                                                               

                           

                            




                              

                                                          
 

                                                                                     
 

                                                          
 

                                                                                  
 

                                                                         
 

                                                                    

                                
                                      




                             


                                                         
 


                                                                                    
 


                                                         
 


                                                                                 
 


                                                                        
 


                                                                   




                             

                                              
 

                                                                       
 

                                              
 

                                                                    
 

                                                             
 

                                                      

                               
                                    



                                        

                                                     




                              

                                               
 

                                                                        
 

                                               
 

                                                                     
 

                                                              
 

                                                       

                                
                                      





                               

                                                
 

                                                                         
 

                                                
 

                                                                      
 

                                                               
 

                                                        

                                 
                                    





                                

                                                 
 

                                                                          
 

                                                 
 

                                                                       
 

                                                                
 

                                                         

                                  
                                   





                               

                                                
 

                                                                         
 

                                                
 

                                                                      
 

                                                               
 

                                                        

                                 
                                 





                               

                                                
 

                                                                         
 

                                                
 

                                                                      
 

                                                               
 

                                                        

                                 
                                 





                     

                                      
 

                                                               
 

                                      
 

                                                            
 

                                                     
 

                                              

                       
                        





                     

                                  
 

                                  

                       
                        




                         

                                                     
 

                                                                                
 

                                                     
 

                                                                             
 

                                                                    
 

                                                               



                                                                           

                                                        
 

                                                                                   
 

                                                        
 

                                                                                
 

                                                                       
 

                                                                  

                              
                               




                              


                                                          
 


                                                                                     

                                
                                 




                             


                                                         
 


                                                                                    

                               
                                




                             

                                              
 

                                                                       
 

                                              
 

                                                                    
 

                                                             
 

                                                      

                               
                                





                         

                                          
 

                                                                   
 

                                          
 

                                                                
 

                                                         
 

                                                  

                           
                            




                                                                            

                                                     
 

                                                                                
 

                                                     
 

                                                                             
 

                                                                    
 

                                                               

                           
                            



                        

                                                                      
 

                                                                                                 
 

                                                                      
 

                                                                                              
 

                                                                                     
 

                                                                                

                          
                           






                               

                                                
 

                                                                         
 

                                                
 

                                                                      
 

                                                               
 

                                                        

                                 
                                  




                                

                                                            
 

                                                                                       
 

                                                            
 

                                                                                    
 

                                                                           
 

                                                                      

                                  
                                   




                               

                                                           
 

                                                                                      
 

                                                           
 

                                                                                   
 

                                                                          
 

                                                                     

                                 
                                  




                               

                                                           
 

                                                                                      
 

                                                           
 

                                                                                   
 

                                                                          
 

                                                                     

                                 
                                  





                       

                                        
 

                                                                 
 

                                        
 

                                                              
 

                                                       
 

                                                

                         
                          





                          

                                           
 

                                                                    
 

                                           
 

                                                                 
 

                                                          
 

                                                   


                                 


                                                  
 

                                                                           

                            
                             



                               


                                                      
 


                                                                                 
 


                                                      
 


                                                                              
 


                                                                     
 


                                                                

                                 
                                  




                          


                                                      
 


                                                                                 
 


                                                      
 


                                                                              
 


                                                                     
 


                                                                

                            
                             





                            

                                                        
 

                                                                                   
 

                                                        
 

                                                                                
 

                                                                       
 

                                                                  

                              
                               



                            

                                             
 

                                                                      
 

                                             
 

                                                                   
 

                                                            
 

                                                     


                              
                               


                              


                                                          
 


                                                                                     

                                
                                 

 

                             


                                                      
 


                                                                                 

                               
                                



                             

                                              
 

                                                                       
 

                                              
 

                                                                    
 

                                                             
 

                                                      

                               

                                            





                         

                                          
 

                                                                   
 

                                          
 

                                                                
 

                                                         
 

                                                  

                           
                            




                        


                                                      
 


                                                                                 
 


                                                      
 


                                                                              
 


                                                                     
 


                                                                

                          
                           




                               

                                                           
 

                                                                                      
 

                                                           
 

                                                                                   
 

                                                                          
 

                                                                     

                                 
                                  




                                

                                                            
 

                                                                                       
 

                                                            
 

                                                                                    
 

                                                                           
 

                                                                      

                                  
                                   




                               

                                                           
 

                                                                                      
 

                                                           
 

                                                                                   
 

                                                                          
 

                                                                     

                                 
                                  




                               

                                                           
 

                                                                                      
 

                                                           
 

                                                                                   
 

                                                                          
 

                                                                     

                                 
                                  




                       

                                                   
 

                                                                              
 

                                                   
 

                                                                           
 

                                                                  
 

                                                             

                         
                          




                          

                                                      
 

                                                                                 
 

                                                      
 

                                                                              
 

                                                                     
 

                                                                

                            
                             



                               


                                                           
 


                                                                                      
 


                                                           
 


                                                                                   
 


                                                                          
 


                                                                     

                                 
                                  





                          


                                                      
 


                                                                                 
 


                                                      
 


                                                                              
 


                                                                     
 


                                                                

                            
                             

 
                                     
 

                      









                                                                           
                                                                            



















                                                         



                          
                                                    


                          
                                                    



                                      



                                                                     


                   
                        
                            
 



                                            



                 


                                                               
 





                                                      

       




                                                       

       

                            
                                                         


                         








                                                              



                                    













                                                                             

        

                      

                                              

 




                                                      



                        
                             


                             

                                                     


                        





















                                                                              

                       




                                                                                                





                      






                                                                       
       
 

                              

                                                         
 


                                                                                    
 
                  

                   










                                                                             




                            



                                                                         



                        
















                                                                              

                         
       
                          

                                                         
 

                                                                                    
 


                                                         
 


                                                                                 
 


                                                                        
 


                                                                   


                               

                                                              
 

                                                                                         


                               

                                                              
 

                                                                                         


                                  

                                                   
 

                                                                            



                             









                                                                        
 



                                                                          
 



                                                                     
 



                                                           
 



                                                                                      
 
                                                          
 
                                                                         
 
                                                                    
 
                                                          



                                  

                                                   
 


                                                                           
 

                                                                  
 

                                                             
 

                                                   
 

                                                                              



                           




                                                                  
 


                                                                             
 


                                                                    
 


                                                     
 


                                                                                



                  






















                                                                   




                          


                                                           
 


                                                                                   
 


                                                                          
 


                                                                     
 


                                                           
 


                                                                                      



                        



                                                               



                     




                                                               



                     



                                                                      



                     


                                                                          

                





                                                                                        

        


                                                                          
 


                                                                                                
 


                                                                                         
 


                                                                                  



                         






                                                         


                                       

                                                                   
 

                                                                                              
 

                                                                   
 

                                                                                           
 

                                                                                  
 

                                                                             


                                   

                                     
                




                                                             

        

                                                                                

                




                                                         

        

                                                                             
 

                                                                    
                




                                                                   



                                     

                                                                 
 

                                                                                            
 

                                                                 
 

                                                                                         
 

                                                                                
 

                                                                           


                            




                                                                                                 

                  




                                                  

                      





                                                                                                       


                             

                                                             
 

                                                                                        
 

                                                             
 

                                                                                     
 

                                                                            
 

                                                                       


                      

                                     
 

                                                                
 

                                                                               


                    

                                                          
 

                                                                                     
 

                                                             
 

                                                          

                                   
                                    



                                 













                                                                             


                                       



                                                                               



                              






                                                                        


                                  
                                                                  


                                
                                                                     


                                         
                                                                  


                               



                                                           


                          


                                                                         


                              
              
           

                                                          



                        







                                                                            

                                 

                                                      
 

                                                                  
 

                                                      
 

                                                                                          
 

                                                                                 
 

                                                                  




                              
                                                     
            



                                                



                              
                                     


                            
                                           


                            

                                                                  




                                  
                                                     
            





                                                           
        
 

                                 









                                                                                       


                                

                                       


                      


                                           



                       









                                                                         
        


                         
                                                  
 

                                        













                                                                                                                                         

 

                    
                    

                
                               
                





                                                                     

                 

































                                                                                   

                                                 








                                                       
               


               
 
                        
                              


                                              









                                                                               

                                          

                                                                             
                                                   
%%
%% %CopyrightBegin%
%%
%% Copyright Ericsson AB 2001-2012. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
%% compliance with the License. You should have received a copy of the
%% Erlang Public License along with this software. If not, it can be
%% retrieved online at http://www.erlang.org/.
%%
%% Software distributed under the License is distributed on an "AS IS"
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
%% the License for the specific language governing rights and limitations
%% under the License.
%%
%% %CopyrightEnd%
%%
%%
%%% Purpose : Test suite for the ASN.1 application

-module(asn1_%BIN%SUITE).
-define(PER, '%PER%').
-define(BER, '%BER%').
-define(ber_driver(Erule, Func),
    case Erule of
        ber_bin_v2 -> Func;
        _          -> ok
    end).
-define(per_optimize(Erule),
    case Erule of
       ber_bin_v2 -> [optimize];
       _          -> []
    end).
-define(per_bit_opt(FuncCall),
    case ?BER of
        ber_bin_v2 -> FuncCall;
        _          -> ok
    end).
-define(uper_bin(FuncCall),
    case ?PER of
        per -> FuncCall;
        _   -> ok
    end).

-compile(export_all).
%%-export([Function/Arity, ...]).

-include_lib("test_server/include/test_server.hrl").

%% records used by test-case default
-record('Def1', {bool0,
                 bool1 = asn1_DEFAULT,
                 bool2 = asn1_DEFAULT,
                 bool3 = asn1_DEFAULT}).

suite() -> [{ct_hooks, [ts_install_cth]}].

all() -> [{group, parallel}] ++ common() ++ particular().

groups() ->
    [{compile, parallel([]),
      [c_syntax,
       % Uses 'String'
       {group, [], [c_string_per,
                    c_string_ber]},
       c_implicit_before_choice]},

     {ber, parallel([]),
      [ber_choiceinseq,
       % Uses 'SOpttest'
       {group, [], [ber_optional,
                    ber_optional_keyed_list]},
       ber_other]},

     {app_test, [],
      [{asn1_app_test, all}]},

     {appup_test, [],
      [{asn1_appup_test, all}]},

     {parallel, parallel([]),
      [{group, compile},
       {group, ber},
       % Uses 'Prim'
       {group, [], [testPrim,
                    rtUI]},
       % Uses 'P-Record', 'Constraints', 'MEDIA-GATEWAY-CONTROL'...
       {group, [], [parse,
                    test_driver_load,
                    test_undecoded_rest,
                    test_inline,
                    specialized_decodes,
                    special_decode_performance,
                    testMegaco,
                    testConstraints,
                    testCompactBitString]},
       % Uses 'Def'
       {group, [], [default_ber,
                    default_per,
                    default_per_opt]},
       per,
       {group, [], [testPrimStrings,
                    testInvokeMod]},
       testChoPrim,
       testChoExtension,
       testChoOptional,
       testChoOptionalImplicitTag,
       testChoRecursive,
       testChoTypeRefCho,
       testChoTypeRefPrim,
       testChoTypeRefSeq,
       testChoTypeRefSet,
       testDef,
       testOpt,
       testSeqDefault,
       % Uses 'External'
       {group, [], [testChoExternal,
                    testPrimExternal,
                    testSeqExtension,
                    testSeqExternal,
                    testSeqOfExternal,
                    testSeqTag,
                    testSetExternal,
                    testSetOfExternal,
                    testSetOfTag,
                    testSetTag]},
       testSeqOptional,
       testSeqPrim,
       testSeqTypeRefCho,
       % Uses 'SeqTypeRefPrim'
       {group, [], [testSeqTypeRefPrim,
                    testTypeValueNotation]},
       testSeqTypeRefSeq,
       testSeqTypeRefSet,
       % Uses 'SeqOf'
       {group, [], [testSeqOf,
                    testSeqOfIndefinite]}, % Uses 'Mvrasn*'
       testSeqOfCho,
       testSetDefault,
       testSetExtension,
       testExtensionAdditionGroup,
       testSeqOfTag,
       testSetOptional,
       testSetPrim,
       testSetTypeRefCho,
       testSetTypeRefPrim,
       testSetTypeRefSeq,
       testSetTypeRefSet,
       testSetOf,
       testSetOfCho,
       testEnumExt,
       value_test,
       testSeq2738,
       % Uses 'Constructed'
       {group, [], [constructed,
                    ber_decode_error]},
       % Uses 'MULTIMEDIA-SYSTEM-CONTROL'
       {group, [], [h323test,
                    per_GeneralString]},
       % Uses 'SeqSetIndefinite'
       {group, [], [testSeqIndefinite,
                    testSetIndefinite]},
       testChoiceIndefinite,
       per_open_type,
       testInfObjectClass,
       testParameterizedInfObj,
       testMergeCompile,
       testobj,
       testDeepTConstr,
       testExport,
       testImport,
       % Uses 'ParamBasic'
       {group, [], [testParamBasic,
                    testDER]},
       testMvrasn6,
       testContextSwitchingTypes,
       testOpenTypeImplicitTag,
       duplicate_tags,
       testROSE,
       testINSTANCE_OF,
       testTCAP,
       test_ParamTypeInfObj,
       test_WS_ParamClass,
       test_Defed_ObjectIdentifier,
       testSelectionType,
       testSSLspecs,
       testNortel,
       % Uses 'PKCS7'
       {group, [], [test_modified_x420,
                    testX420]},
       testTcapsystem,
       testNBAPsystem,
       test_compile_options,
       testDoubleEllipses,
       test_x691,
       ticket_6143,
       testExtensionAdditionGroup,
       test_OTP_9688]}
    ].

parallel(Options) ->
    case erlang:system_info(smp_support) andalso
         erlang:system_info(schedulers) > 1 of
        true  -> [parallel|Options];
        false -> Options
    end.

init_per_suite(Config) ->
    io:format("code:lib_dir(asn1) = ~p~n", [code:lib_dir(asn1)]),
    Config.

end_per_suite(_Config) ->
    ok.

init_per_group(_GroupName, Config) ->
    Config.

end_per_group(_GroupName, Config) ->
    Config.

init_per_testcase(Func, Config) ->
    PrivDir = ?config(priv_dir, Config),
    true = code:add_patha(PrivDir),

    CaseDir = filename:join([PrivDir, ?MODULE, Func]),
    ok = filelib:ensure_dir(filename:join([CaseDir, dummy_file])),
    true = code:add_patha(CaseDir),

    Dog = case Func of
              testX420 -> test_server:timetrap({minutes, 60});
              _        -> test_server:timetrap({minutes, 30})
          end,
    [{case_dir, CaseDir}, {watchdog, Dog}|Config].

end_per_testcase(_Func, Config) ->
    Dog = ?config(watchdog, Config),
    % TODO: Clean up case_dir + code path?
    test_server:timetrap_cancel(Dog).


testPrim(suite) -> [];
testPrim(Config) ->
    Files = ["Prim", "Real"],

    asn1_test_lib:compile_all(Files, Config, [?BER]),
    testPrim_cases(?BER),

    ?ber_driver(?BER, asn1_test_lib:compile_all(Files, Config, [?BER, driver])),
    ?ber_driver(?BER, testPrim_cases(?BER)),

    asn1_test_lib:compile_all(Files, Config, [?PER]),
    testPrim_cases(?PER),

    ?per_bit_opt(asn1_test_lib:compile_all(Files, Config, [?PER, optimize])),
    ?per_bit_opt(testPrim_cases(?PER)),

    ?uper_bin(asn1_test_lib:compile_all(Files, Config, [uper_bin])),
    ?uper_bin(testPrim_cases(uper_bin)),

    asn1_test_lib:compile_all(Files, Config, [?PER, optimize]),
    testPrim_cases(?PER).

testPrim_cases(Rules) ->
    testPrim:bool(Rules),
    testPrim:int(Rules),
    testPrim:enum(Rules),
    testPrim:obj_id(Rules),
    testPrim:rel_oid(Rules),
    testPrim:null(Rules),
    testPrim:real(Rules).


testCompactBitString(suite) -> [];
testCompactBitString(Config) ->
    testCompactBitString:compile(Config, [?BER, compact_bit_string]),
    testCompactBitString:compact_bit_string(?BER),

    ?ber_driver(?BER, testCompactBitString:compile(Config, [?BER, compact_bit_string, driver])),
    ?ber_driver(?BER, testCompactBitString:compact_bit_string(?BER)),

    testCompactBitString:compile(Config, [?PER, compact_bit_string]),
    testCompactBitString:compact_bit_string(?PER),
    testCompactBitString:bit_string_unnamed(?PER),

    ?per_bit_opt(testCompactBitString:compile(Config, [?PER, compact_bit_string, optimize])),
    ?per_bit_opt(testCompactBitString:compact_bit_string(?PER)),
    ?per_bit_opt(testCompactBitString:bit_string_unnamed(?PER)),
    ?per_bit_opt(testCompactBitString:ticket_7734(?PER)),

    ?uper_bin(testCompactBitString:compile(Config, [uper_bin, compact_bit_string])),
    ?uper_bin(testCompactBitString:compact_bit_string(uper_bin)),
    ?uper_bin(testCompactBitString:bit_string_unnamed(uper_bin)),

    testCompactBitString:compile(Config, [?PER, optimize, compact_bit_string]),
    testCompactBitString:compact_bit_string(?PER),
    testCompactBitString:bit_string_unnamed(?PER),

    testCompactBitString:otp_4869(?PER).


testPrimStrings(suite) -> [];
testPrimStrings(Config) ->

    testPrimStrings:compile(Config, ?BER, []),
    testPrimStrings_cases(?BER),
    testPrimStrings:more_strings(?BER), %% these are not implemented in per yet
    ?ber_driver(?BER, testPrimStrings:compile(Config, ?BER, [driver])),
    ?ber_driver(?BER, testPrimStrings_cases(?BER)),
    ?ber_driver(?BER, testPrimStrings:more_strings(?BER)),

    testPrimStrings:compile(Config, ?PER, []),
    testPrimStrings_cases(?PER),

    ?per_bit_opt(testPrimStrings:compile(Config, ?PER, [optimize])),
    ?per_bit_opt(testPrimStrings_cases(?PER)),

    ?uper_bin(testPrimStrings:compile(Config, uper_bin, [])),
    ?uper_bin(testPrimStrings_cases(uper_bin)),

    testPrimStrings:compile(Config, ?PER, [optimize]),
    testPrimStrings_cases(?PER).

testPrimStrings_cases(Rules) ->
    testPrimStrings:bit_string(Rules),
    testPrimStrings:bit_string_unnamed(Rules),
    testPrimStrings:octet_string(Rules),
    testPrimStrings:numeric_string(Rules),
    testPrimStrings:other_strings(Rules),
    testPrimStrings:universal_string(Rules),
    testPrimStrings:bmp_string(Rules),
    testPrimStrings:times(Rules),
    testPrimStrings:utf8_string(Rules).



testPrimExternal(suite) -> [];
testPrimExternal(Config) ->
    asn1_test_lib:compile("External", Config, [?BER]),
    asn1_test_lib:compile("PrimExternal", Config, [?BER]),
    testPrimExternal:external(?BER),

    ?ber_driver(?BER, asn1_test_lib:compile("External", Config, [?BER, driver])),
    ?ber_driver(?BER, asn1_test_lib:compile("PrimExternal", Config, [?BER, driver])),
    ?ber_driver(?BER, testPrimExternal:external(?BER)),

    asn1_test_lib:compile("External", Config, [?PER]),
    asn1_test_lib:compile("PrimExternal", Config, [?PER]),
    testPrimExternal:external(?PER),

    ?per_bit_opt(asn1_test_lib:compile("External", Config, [?PER, optimize])),
    ?per_bit_opt(asn1_test_lib:compile("PrimExternal", Config, [?PER, optimize])),
    ?per_bit_opt(testPrimExternal:external(?PER)),

    ?uper_bin(asn1_test_lib:compile("External", Config, [uper_bin])),
    ?uper_bin(asn1_test_lib:compile("PrimExternal", Config, [uper_bin])),
    ?uper_bin(testPrimExternal:external(uper_bin)),

    asn1_test_lib:compile("External", Config,     [?PER, optimize]),
    asn1_test_lib:compile("PrimExternal", Config, [?PER, optimize]),
    testPrimExternal:external(?PER).


testChoPrim(suite) -> [];
testChoPrim(Config) ->
    asn1_test_lib:compile("ChoPrim", Config, [?BER]),
    testChoPrim_cases(?BER),

    ?ber_driver(?BER, asn1_test_lib:compile("ChoPrim", Config, [?BER, driver])),
    ?ber_driver(?BER, testChoPrim_cases(?BER)),

    asn1_test_lib:compile("ChoPrim", Config, [?PER]),
    testChoPrim_cases(?PER),

    ?per_bit_opt(asn1_test_lib:compile("ChoPrim", Config, [?PER, optimize])),
    ?per_bit_opt(testChoPrim_cases(?PER)),

    ?uper_bin(asn1_test_lib:compile("ChoPrim", Config, [uper_bin])),
    ?uper_bin(testChoPrim_cases(uper_bin)),

    asn1_test_lib:compile("ChoPrim", Config, [?PER, optimize]),
    testChoPrim_cases(?PER).

testChoPrim_cases(Rules) ->
    testChoPrim:bool(Rules),
    testChoPrim:int(Rules).



testChoExtension(suite) -> [];
testChoExtension(Config) ->
    asn1_test_lib:compile("ChoExtension", Config, [?BER]),
    testChoExtension_cases(?BER),

    ?ber_driver(?BER, asn1_test_lib:compile("ChoExtension", Config, [?BER, driver])),
    ?ber_driver(?BER, testChoExtension_cases(?BER)),

    asn1_test_lib:compile("ChoExtension", Config, [?PER]),
    testChoExtension_cases(?PER),

    ?per_bit_opt(asn1_test_lib:compile("ChoExtension", Config, [?PER, optimize])),
    ?per_bit_opt(testChoExtension_cases(?PER)),

    ?uper_bin(asn1_test_lib:compile("ChoExtension", Config, [uper_bin])),
    ?uper_bin(testChoExtension_cases(uper_bin)),

    asn1_test_lib:compile("ChoExtension", Config, [?PER, optimize]),
    testChoExtension_cases(?PER).

testChoExtension_cases(Rules) ->
    testChoExtension:extension(Rules).



testChoExternal(suite) -> [];
testChoExternal(Config) ->
    asn1_test_lib:compile("External", Config, [?BER]),
    asn1_test_lib:compile("ChoExternal", Config, [?BER]),
    testChoExternal:external(?BER),

    ?ber_driver(?BER, asn1_test_lib:compile("External", Config, [?BER, driver])),
    ?ber_driver(?BER, asn1_test_lib:compile("ChoExternal", Config, [?BER, driver])),
    ?ber_driver(?BER, testChoExternal:external(?BER)),

    asn1_test_lib:compile("External", Config, [?PER]),
    asn1_test_lib:compile("ChoExternal", Config, [?PER]),
    testChoExternal:external(?PER),

    ?per_bit_opt(asn1_test_lib:compile("External", Config, [?PER, optimize])),
    ?per_bit_opt(asn1_test_lib:compile("ChoExternal", Config, [?PER, optimize])),
    ?per_bit_opt(testChoExternal:external(?PER)),

    ?uper_bin(asn1_test_lib:compile("External", Config,    [uper_bin])),
    ?uper_bin(asn1_test_lib:compile("ChoExternal", Config, [uper_bin])),
    ?uper_bin(testChoExternal:external(uper_bin)),

    asn1_test_lib:compile("External", Config,    [?PER, optimize]),
    asn1_test_lib:compile("ChoExternal", Config, [?PER, optimize]),
    testChoExternal:external(?PER).


testChoOptional(suite) -> [];
testChoOptional(Config) ->

    testChoOptional:compile(Config, ?BER, []),
    testChoOptional_cases(?BER),

    ?ber_driver(?BER, testChoOptional:compile(Config, ?BER, [driver])),
    ?ber_driver(?BER, testChoOptional_cases(?BER)),

    testChoOptional:compile(Config, ?PER, []),
    testChoOptional_cases(?PER),

    ?per_bit_opt(testChoOptional:compile(Config, ?PER, [optimize])),
    ?per_bit_opt(testChoOptional_cases(?PER)),

    ?uper_bin(testChoOptional:compile(Config, uper_bin, [])),
    ?uper_bin(testChoOptional_cases(uper_bin)),

    testChoOptional:compile(Config, ?PER, [optimize]),
    testChoOptional_cases(?PER).

testChoOptional_cases(Rules) ->
    testChoOptional:optional(Rules).

testChoOptionalImplicitTag(suite) -> [];
testChoOptionalImplicitTag(Config) ->
    %% Only meaningful for ?BER
    testChoOptionalImplicitTag:compile(Config, ?BER),
    testChoOptionalImplicitTag:optional(?BER).


testChoRecursive(suite) -> [];
testChoRecursive(Config) ->

    testChoRecursive:compile(Config, ?BER, []),
    testChoRecursive_cases(?BER),

    ?ber_driver(?BER, testChoRecursive:compile(Config, ?BER, [driver])),
    ?ber_driver(?BER, testChoRecursive_cases(?BER)),

    testChoRecursive:compile(Config, ?PER, []),
    testChoRecursive_cases(?PER),

    ?per_bit_opt(testChoRecursive:compile(Config, ?PER, [optimize])),
    ?per_bit_opt(testChoRecursive_cases(?PER)),

    ?uper_bin(testChoRecursive:compile(Config, uper_bin, [])),
    ?uper_bin(testChoRecursive_cases(uper_bin)),

    testChoRecursive:compile(Config, ?PER, [optimize]),
    testChoRecursive_cases(?PER).

testChoRecursive_cases(Rules) ->
    testChoRecursive:recursive(Rules).



testChoTypeRefCho(suite) -> [];
testChoTypeRefCho(Config) ->

    testChoTypeRefCho:compile(Config, ?BER, []),
    testChoTypeRefCho_cases(?BER),

    ?ber_driver(?BER, testChoTypeRefCho:compile(Config, ?BER, [driver])),
    ?ber_driver(?BER, testChoTypeRefCho_cases(?BER)),

    testChoTypeRefCho:compile(Config, ?PER, []),
    testChoTypeRefCho_cases(?PER),

    ?per_bit_opt(testChoTypeRefCho:compile(Config, ?PER, [optimize])),
    ?per_bit_opt(testChoTypeRefCho_cases(?PER)),

    ?uper_bin(testChoTypeRefCho:compile(Config, uper_bin, [])),
    ?uper_bin(testChoTypeRefCho_cases(uper_bin)),

    testChoTypeRefCho:compile(Config, ?PER, [optimize]),
    testChoTypeRefCho_cases(?PER).

testChoTypeRefCho_cases(Rules) ->
    testChoTypeRefCho:choice(Rules).



testChoTypeRefPrim(suite) -> [];
testChoTypeRefPrim(Config) ->

    testChoTypeRefPrim:compile(Config, ?BER, []),
    testChoTypeRefPrim_cases(?BER),

    ?ber_driver(?BER, testChoTypeRefPrim:compile(Config, ?BER, [driver])),
    ?ber_driver(?BER, testChoTypeRefPrim_cases(?BER)),

    testChoTypeRefPrim:compile(Config, ?PER, []),
    testChoTypeRefPrim_cases(?PER),

    ?per_bit_opt(testChoTypeRefPrim:compile(Config, ?PER, [optimize])),
    ?per_bit_opt(testChoTypeRefPrim_cases(?PER)),

    ?uper_bin(testChoTypeRefPrim:compile(Config, uper_bin, [])),
    ?uper_bin(testChoTypeRefPrim_cases(uper_bin)),

    testChoTypeRefPrim:compile(Config, ?PER, [optimize]),
    testChoTypeRefPrim_cases(?PER).

testChoTypeRefPrim_cases(Rules) ->
    testChoTypeRefPrim:prim(Rules).



testChoTypeRefSeq(suite) -> [];
testChoTypeRefSeq(Config) ->

    testChoTypeRefSeq:compile(Config, ?BER, []),
    testChoTypeRefSeq_cases(?BER),

    ?ber_driver(?BER, testChoTypeRefSeq:compile(Config, ?BER, [driver])),
    ?ber_driver(?BER, testChoTypeRefSeq_cases(?BER)),

    testChoTypeRefSeq:compile(Config, ?PER, []),
    testChoTypeRefSeq_cases(?PER),

    ?per_bit_opt(testChoTypeRefSeq:compile(Config, ?PER, [optimize])),
    ?per_bit_opt(testChoTypeRefSeq_cases(?PER)),

    ?uper_bin(testChoTypeRefSeq:compile(Config, uper_bin, [])),
    ?uper_bin(testChoTypeRefSeq_cases(uper_bin)),

    testChoTypeRefSeq:compile(Config, ?PER, [optimize]),
    testChoTypeRefSeq_cases(?PER).

testChoTypeRefSeq_cases(Rules) ->
    testChoTypeRefSeq:seq(Rules).



testChoTypeRefSet(suite) -> [];
testChoTypeRefSet(Config) ->

    testChoTypeRefSet:compile(Config, ?BER, []),
    testChoTypeRefSet_cases(?BER),

    ?ber_driver(?BER, testChoTypeRefSet:compile(Config, ?BER, [driver])),
    ?ber_driver(?BER, testChoTypeRefSet_cases(?BER)),

    testChoTypeRefSet:compile(Config, ?PER, []),
    testChoTypeRefSet_cases(?PER),

    ?per_bit_opt(testChoTypeRefSet:compile(Config, ?PER, [optimize])),
    ?per_bit_opt(testChoTypeRefSet_cases(?PER)),

    ?uper_bin(testChoTypeRefSet:compile(Config, uper_bin, [])),
    ?uper_bin(testChoTypeRefSet_cases(uper_bin)),

    testChoTypeRefSet:compile(Config, ?PER, [optimize]),
    testChoTypeRefSet_cases(?PER).

testChoTypeRefSet_cases(Rules) ->
    testChoTypeRefSet:set(Rules).



testDef(suite) -> [];
testDef(Config) ->

    testDef:compile(Config, ?BER, []),
    testDef_cases(?BER),

    ?ber_driver(?BER, testDef:compile(Config, ?BER, [driver])),
    ?ber_driver(?BER, testDef_cases(?BER)),

    testDef:compile(Config, ?PER, []),
    testDef_cases(?PER),

    ?per_bit_opt(testDef:compile(Config, ?PER, [optimize])),
    ?per_bit_opt(testDef_cases(?PER)),

    ?uper_bin(testDef:compile(Config, uper_bin, [])),
    ?uper_bin(testDef_cases(uper_bin)),

    testDef:compile(Config, ?PER, [optimize]),
    testDef_cases(?PER).

testDef_cases(Rules) ->
    testDef:main(Rules).



testOpt(suite) -> [];
testOpt(Config) ->

    testOpt:compile(Config, ?BER),
    testOpt_cases(?BER),

    testOpt:compile(Config, ?PER),
    testOpt_cases(?PER).

testOpt_cases(Rules) ->
    testOpt:main(Rules).


testEnumExt(suite) -> [];
testEnumExt(Config) ->

    asn1_test_lib:compile("EnumExt", Config, [?BER]),
    testEnumExt:main(?BER),

    ?ber_driver(?BER, asn1_test_lib:compile("EnumExt", Config, [?BER, driver])),
    ?ber_driver(?BER, testEnumExt:main(?BER)),

    asn1_test_lib:compile("EnumExt", Config, [?PER]),
    testEnumExt:main(?PER),

    ?per_bit_opt(asn1_test_lib:compile("EnumExt", Config, [?PER, optimize])),
    ?per_bit_opt(testEnumExt:main(?PER)),

    ?uper_bin(asn1_test_lib:compile("EnumExt", Config, [uper_bin])),
    ?uper_bin(testEnumExt:main(uper_bin)),

    asn1_test_lib:compile("EnumExt", Config, [?PER, optimize]),
    testEnumExt:main(?PER).

testSeqDefault(doc) -> ["Test of OTP-2523 ENUMERATED with extensionmark."];
testSeqDefault(suite) -> [];
testSeqDefault(Config) ->
    asn1_test_lib:compile("SeqDefault", Config, [?BER]),
    testSeqDefault_cases(?BER),

    ?ber_driver(?BER, asn1_test_lib:compile("SeqDefault", Config, [?BER, driver])),
    ?ber_driver(?BER, testSeqDefault_cases(?BER)),

    asn1_test_lib:compile("SeqDefault", Config, [?PER]),
    testSeqDefault_cases(?PER),

    ?per_bit_opt(asn1_test_lib:compile("SeqDefault", Config, [?PER, optimize])),
    ?per_bit_opt(testSeqDefault_cases(?PER)),

    ?uper_bin(asn1_test_lib:compile("SeqDefault", Config, [uper_bin])),
    ?uper_bin(testSeqDefault_cases(uper_bin)),

    asn1_test_lib:compile("SeqDefault", Config, [?PER, optimize]),
    testSeqDefault_cases(?PER).

testSeqDefault_cases(Rules) ->
    testSeqDefault:main(Rules).



testSeqExtension(suite) -> [];
testSeqExtension(Config) ->
    asn1_test_lib:compile("External", Config, [?BER]),
    asn1_test_lib:compile("SeqExtension", Config, [?BER]),
    testSeqExtension_cases(?BER),

    ?ber_driver(?BER, asn1_test_lib:compile("External", Config, [?BER, driver])),
    ?ber_driver(?BER, asn1_test_lib:compile("SeqExtension", Config, [?BER, driver])),
    ?ber_driver(?BER, testSeqExtension_cases(?BER)).

testSeqExtension_cases(Rules) ->
    testSeqExtension:main(Rules).



testSeqExternal(suite) -> [];
testSeqExternal(Config) ->
    asn1_test_lib:compile("External", Config, [?BER]),
    asn1_test_lib:compile("SeqExternal", Config, [?BER]),
    testSeqExternal_cases(?BER),

    ?ber_driver(?BER, asn1_test_lib:compile("External", Config, [?BER, driver])),
    ?ber_driver(?BER, asn1_test_lib:compile("SeqExternal", Config, [?BER, driver])),
    ?ber_driver(?BER, testSeqExternal_cases(?BER)).

testSeqExternal_cases(Rules) ->
    testSeqExternal:main(Rules).


testSeqOptional(suite) -> [];
testSeqOptional(Config) ->

    testSeqOptional:compile(Config, ?BER, []),
    testSeqOptional_cases(?BER),

    ?ber_driver(?BER, testSeqOptional:compile(Config, ?BER, [driver])),
    ?ber_driver(?BER, testSeqOptional_cases(?BER)),

    testSeqOptional:compile(Config, ?PER, []),
    testSeqOptional_cases(?PER),

    ?per_bit_opt(testSeqOptional:compile(Config, ?PER, [optimize])),
    ?per_bit_opt(testSeqOptional_cases(?PER)),

    ?uper_bin(testSeqOptional:compile(Config, uper_bin, [])),
    ?uper_bin(testSeqOptional_cases(uper_bin)),

    testSeqOptional:compile(Config, ?PER, [optimize]),
    testSeqOptional_cases(?PER).

testSeqOptional_cases(Rules) ->
    testSeqOptional:main(Rules).



testSeqPrim(suite) -> [];
testSeqPrim(Config) ->

    testSeqPrim:compile(Config, ?BER, []),
    testSeqPrim_cases(?BER),

    ?ber_driver(?BER, testSeqPrim:compile(Config, ?BER, [driver])),
    ?ber_driver(?BER, testSeqPrim_cases(?BER)),

    testSeqPrim:compile(Config, ?PER, []),
    testSeqPrim_cases(?PER),

    ?per_bit_opt(testSeqPrim:compile(Config, ?PER, [optimize])),
    ?per_bit_opt(testSeqPrim_cases(?PER)),

    ?uper_bin(testSeqPrim:compile(Config, uper_bin, [])),
    ?uper_bin(testSeqPrim_cases(uper_bin)),

    testSeqPrim:compile(Config, ?PER, [optimize]),
    testSeqPrim_cases(?PER).

testSeqPrim_cases(Rules) ->
    testSeqPrim:main(Rules).


testSeq2738(doc) -> ["Test of OTP-2738 Detect corrupt optional component."];
testSeq2738(suite) -> [];
testSeq2738(Config) ->
    asn1_test_lib:compile("Seq2738", Config, [?BER]),
    testSeq2738_cases(?BER),

    ?ber_driver(?BER, asn1_test_lib:compile("Seq2738", Config, [?BER, driver])),
    ?ber_driver(?BER, testSeq2738_cases(?BER)),

    asn1_test_lib:compile("Seq2738", Config, [?PER]),
    testSeq2738_cases(?PER),

    ?per_bit_opt(asn1_test_lib:compile("Seq2738", Config, [?PER, optimize])),
    ?per_bit_opt(testSeq2738_cases(?PER)),

    ?uper_bin(asn1_test_lib:compile("Seq2738", Config, [uper_bin])),
    ?uper_bin(testSeq2738_cases(uper_bin)),

    asn1_test_lib:compile("Seq2738", Config, [?PER, optimize]),
    testSeq2738_cases(?PER).

testSeq2738_cases(Rules) ->
    testSeq2738:main(Rules).


testSeqTag(suite) -> [];
testSeqTag(Config) ->
    asn1_test_lib:compile_all(["External", "SeqTag"], Config, [?BER]),
    testSeqTag_cases(?BER),

    ?ber_driver(?BER, asn1_test_lib:compile_all(["External", "SeqTag"], Config, [?BER, driver])),
    ?ber_driver(?BER, testSeqTag_cases(?BER)),

    asn1_test_lib:compile_all(["External", "SeqTag"], Config, [?PER]),
    testSeqTag_cases(?PER),

    ?per_bit_opt(asn1_test_lib:compile_all(["External", "SeqTag"], Config, [?PER, optimize])),
    ?per_bit_opt(testSeqTag_cases(?PER)),

    ?uper_bin(asn1_test_lib:compile_all(["External", "SeqTag"], Config, [uper_bin])),
    ?uper_bin(testSeqTag_cases(uper_bin)),

    asn1_test_lib:compile_all(["External", "SeqTag"], Config, [?PER, optimize]),
    testSeqTag_cases(?PER).

testSeqTag_cases(Rules) ->
    testSeqTag:main(Rules).




testSeqTypeRefCho(suite) -> [];
testSeqTypeRefCho(Config) ->

    testSeqTypeRefCho:compile(Config, ?BER, []),
    testSeqTypeRefCho_cases(?BER),

    ?ber_driver(?BER, testSeqTypeRefCho:compile(Config, ?BER, [driver])),
    ?ber_driver(?BER, testSeqTypeRefCho_cases(?BER)),

    testSeqTypeRefCho:compile(Config, ?PER, []),
    testSeqTypeRefCho_cases(?PER),

    ?per_bit_opt(testSeqTypeRefCho:compile(Config, ?PER, [optimize])),
    ?per_bit_opt(testSeqTypeRefCho_cases(?PER)),

    ?uper_bin(testSeqTypeRefCho:compile(Config, uper_bin, [])),
    ?uper_bin(testSeqTypeRefCho_cases(uper_bin)),

    testSeqTypeRefCho:compile(Config, ?PER, [optimize]),
    testSeqTypeRefCho_cases(?PER).

testSeqTypeRefCho_cases(Rules) ->
    testSeqTypeRefCho:main(Rules).



testSeqTypeRefPrim(suite) -> [];
testSeqTypeRefPrim(Config) ->
    asn1_test_lib:compile("SeqTypeRefPrim", Config, [?BER]),
    testSeqTypeRefPrim_cases(?BER),

    ?ber_driver(?BER, asn1_test_lib:compile("SeqTypeRefPrim", Config, [?BER, driver])),
    ?ber_driver(?BER, testSeqTypeRefPrim_cases(?BER)),

    asn1_test_lib:compile("SeqTypeRefPrim", Config, [?PER]),
    testSeqTypeRefPrim_cases(?PER),

    ?per_bit_opt(asn1_test_lib:compile("SeqTypeRefPrim", Config, [?PER, optimize])),
    ?per_bit_opt(testSeqTypeRefPrim_cases(?PER)),

    ?uper_bin(asn1_test_lib:compile("SeqTypeRefPrim", Config, [uper_bin])),
    ?uper_bin(testSeqTypeRefPrim_cases(uper_bin)),

    asn1_test_lib:compile("SeqTypeRefPrim", Config, [?PER, optimize]),
    testSeqTypeRefPrim_cases(?PER).

testSeqTypeRefPrim_cases(Rules) ->
    testSeqTypeRefPrim:main(Rules).



testSeqTypeRefSeq(suite) -> [];
testSeqTypeRefSeq(Config) ->
    asn1_test_lib:compile("SeqTypeRefSeq", Config, [?BER]),
    testSeqTypeRefSeq_cases(?BER),

    ?ber_driver(?BER, asn1_test_lib:compile("SeqTypeRefSeq", Config, [?BER, driver])),
    ?ber_driver(?BER, testSeqTypeRefSeq_cases(?BER)),

    asn1_test_lib:compile("SeqTypeRefSeq", Config, [?PER]),
    testSeqTypeRefSeq_cases(?PER),

    ?per_bit_opt(asn1_test_lib:compile("SeqTypeRefSeq", Config, [?PER, optimize])),
    ?per_bit_opt(testSeqTypeRefSeq_cases(?PER)),

    ?uper_bin(asn1_test_lib:compile("SeqTypeRefSeq", Config, [uper_bin])),
    ?uper_bin(testSeqTypeRefSeq_cases(uper_bin)),

    asn1_test_lib:compile("SeqTypeRefSeq", Config, [?PER, optimize]),
    testSeqTypeRefSeq_cases(?PER).

testSeqTypeRefSeq_cases(Rules) ->
    testSeqTypeRefSeq:main(Rules).



testSeqTypeRefSet(suite) -> [];
testSeqTypeRefSet(Config) ->
    asn1_test_lib:compile("SeqTypeRefSet", Config, [?BER]),
    testSeqTypeRefSet_cases(?BER),

    ?ber_driver(?BER, asn1_test_lib:compile("SeqTypeRefSet", Config, [?BER, driver])),
    ?ber_driver(?BER, testSeqTypeRefSet_cases(?BER)),

    asn1_test_lib:compile("SeqTypeRefSet", Config, [?PER]),
    testSeqTypeRefSet_cases(?PER),

    ?per_bit_opt(asn1_test_lib:compile("SeqTypeRefSet", Config, [?PER, optimize])),
    ?per_bit_opt(testSeqTypeRefSet_cases(?PER)),

    ?uper_bin(asn1_test_lib:compile("SeqTypeRefSet", Config, [uper_bin])),
    ?uper_bin(testSeqTypeRefSet_cases(uper_bin)),

    asn1_test_lib:compile("SeqTypeRefSet", Config, [?PER, optimize]),
    testSeqTypeRefSet_cases(?PER).

testSeqTypeRefSet_cases(Rules) ->
    testSeqTypeRefSet:main(Rules).




testSeqOf(suite) -> [];
testSeqOf(Config) ->
    testSeqOf:compile(Config, ?BER, []),
    testSeqOf_cases(?BER),

    ?ber_driver(?BER, testSeqOf:compile(Config, ?BER, [driver])),
    ?ber_driver(?BER, testSeqOf_cases(?BER)),

    testSeqOf:compile(Config, ?PER, []),
    testSeqOf_cases(?PER),

    ?per_bit_opt(testSeqOf:compile(Config, ?PER, [optimize])),
    ?per_bit_opt(testSeqOf_cases(?PER)),

    ?uper_bin(testSeqOf:compile(Config, uper_bin, [])),
    ?uper_bin(testSeqOf_cases(uper_bin)),

    testSeqOf:compile(Config, ?PER, [optimize]),
    testSeqOf_cases(?PER).

testSeqOf_cases(Rules) ->
    testSeqOf:main(Rules).




testSeqOfCho(suite) -> [];
testSeqOfCho(Config) ->
    testSeqOfCho:compile(Config, ?BER, []),
    testSeqOfCho_cases(?BER),

    ?ber_driver(?BER, testSeqOfCho:compile(Config, ?BER, [driver])),
    ?ber_driver(?BER, testSeqOfCho_cases(?BER)),

    testSeqOfCho:compile(Config, ?PER, []),
    testSeqOfCho_cases(?PER),

    ?per_bit_opt(testSeqOfCho:compile(Config, ?PER, [optimize])),
    ?per_bit_opt(testSeqOfCho_cases(?PER)),

    ?uper_bin(testSeqOfCho:compile(Config, uper_bin, [])),
    ?uper_bin(testSeqOfCho_cases(uper_bin)),

    testSeqOfCho:compile(Config, ?PER, [optimize]),
    testSeqOfCho_cases(?PER).

testSeqOfIndefinite(suite) -> [];
testSeqOfIndefinite(Config) ->
    %% Mvrasn (11-21)-4
    testSeqOfIndefinite:compile(Config, ?BER, []),
    testSeqOfIndefinite:main(),

    ?ber_driver(?BER, testSeqOfIndefinite:compile(Config, ?BER, [driver])),
    ?ber_driver(?BER, testSeqOfIndefinite:main()).

testSeqOfCho_cases(Rules) ->
    testSeqOfCho:main(Rules).


testSeqOfExternal(suite) -> [];
testSeqOfExternal(Config) ->
    asn1_test_lib:compile("External", Config, [?BER]),
    testSeqOfExternal:compile(Config, ?BER, []),
    testSeqOfExternal_cases(?BER),

    ?ber_driver(?BER, asn1_test_lib:compile("External", Config, [?BER, driver])),
    ?ber_driver(?BER, testSeqOfExternal:compile(Config, ?BER, [driver])),
    ?ber_driver(?BER, testSeqOfExternal_cases(?BER)),

    asn1_test_lib:compile("External", Config, [?PER]),
    testSeqOfExternal:compile(Config, ?PER, []),
    testSeqOfExternal_cases(?PER),

    ?per_bit_opt(asn1_test_lib:compile("External", Config, [?PER, optimize])),
    ?per_bit_opt(testSeqOfExternal:compile(Config, ?PER, [optimize])),
    ?per_bit_opt(testSeqOfExternal_cases(?PER)),

    ?uper_bin(asn1_test_lib:compile("External", Config, [uper_bin])),
    ?uper_bin(testSeqOfExternal:compile(Config, uper_bin, [])),
    ?uper_bin(testSeqOfExternal_cases(uper_bin)),

    asn1_test_lib:compile("External", Config, [?PER, optimize]),
    testSeqOfExternal:compile(Config, ?PER, [optimize]),
    testSeqOfExternal_cases(?PER).

testSeqOfExternal_cases(Rules) ->
    testSeqOfExternal:main(Rules).



testSeqOfTag(suite) -> [];
testSeqOfTag(Config) ->
    asn1_test_lib:compile("External", Config, [?BER]),
    testSeqOfTag:compile(Config, ?BER, []),
    testSeqOfTag_cases(?BER),

    ?ber_driver(?BER, asn1_test_lib:compile("External", Config, [?BER, driver])),
    ?ber_driver(?BER, testSeqOfTag:compile(Config, ?BER, [driver])),
    ?ber_driver(?BER, testSeqOfTag_cases(?BER)),

    asn1_test_lib:compile("External", Config, [?PER]),
    testSeqOfTag:compile(Config, ?PER, []),
    testSeqOfTag_cases(?PER),

    ?per_bit_opt(asn1_test_lib:compile("External", Config, [?PER, optimize])),
    ?per_bit_opt(testSeqOfTag:compile(Config, ?PER, [optimize])),
    ?per_bit_opt(testSeqOfTag_cases(?PER)),

    ?uper_bin(asn1_test_lib:compile("External", Config, [uper_bin])),
    ?uper_bin(testSeqOfTag:compile(Config, uper_bin, [])),
    ?uper_bin(testSeqOfTag_cases(uper_bin)),

    asn1_test_lib:compile("External", Config, [?PER, optimize]),
    testSeqOfTag:compile(Config, ?PER, [optimize]),
    testSeqOfTag_cases(?PER).

testSeqOfTag_cases(Rules) ->
    testSeqOfTag:main(Rules).




testSetDefault(suite) -> [];
testSetDefault(Config) ->
    asn1_test_lib:compile("SetDefault", Config, [?BER]),
    testSetDefault_cases(?BER),

    ?ber_driver(?BER, asn1_test_lib:compile("SetDefault", Config, [?BER, driver])),
    ?ber_driver(?BER, testSetDefault_cases(?BER)),

    asn1_test_lib:compile("SetDefault", Config, [?PER]),
    testSetDefault_cases(?PER),

    ?per_bit_opt(asn1_test_lib:compile("SetDefault", Config, [?PER, optimize])),
    ?per_bit_opt(testSetDefault_cases(?PER)),

    ?uper_bin(asn1_test_lib:compile("SetDefault", Config, [uper_bin])),
    ?uper_bin(testSetDefault_cases(uper_bin)),

    asn1_test_lib:compile("SetDefault", Config, [?PER, optimize]),
    testSetDefault_cases(?PER).

testSetDefault_cases(Rules) ->
    testSetDefault:main(Rules).


testParamBasic(suite) -> [];
testParamBasic(Config) ->
    testParamBasic:compile(Config, ?BER, []),
    testParamBasic_cases(?BER),

    ?ber_driver(?BER, testParamBasic:compile(Config, ?BER, [driver])),
    ?ber_driver(?BER, testParamBasic_cases(?BER)),

    testParamBasic:compile(Config, ?PER, []),
    testParamBasic_cases(?PER),

    ?per_bit_opt(testParamBasic:compile(Config, ?PER, [optimize])),
    ?per_bit_opt(testParamBasic_cases(?PER)),

    ?uper_bin(testParamBasic:compile(Config, uper_bin, [])),
    ?uper_bin(testParamBasic_cases(uper_bin)),

    testParamBasic:compile(Config, ?PER, [optimize]),
    testParamBasic_cases(?PER).


testParamBasic_cases(Rules) ->
    testParamBasic:main(Rules).

testSetExtension(suite) -> [];
testSetExtension(Config) ->
    asn1_test_lib:compile("External", Config, [?BER]),
    asn1_test_lib:compile("SetExtension", Config, [?BER]),
    testSetExtension_cases(?BER),

    ?ber_driver(?BER, asn1_test_lib:compile("External", Config, [?BER, driver])),
    ?ber_driver(?BER, asn1_test_lib:compile("SetExtension", Config, [?BER, driver])),
    ?ber_driver(?BER, testSetExtension_cases(?BER)).

testSetExtension_cases(Rules) ->
    testSetExtension:main(Rules).


testSetExternal(suite) -> [];
testSetExternal(Config) ->
    asn1_test_lib:compile("External", Config, [?BER]),
    testSetExternal:compile(Config, ?BER, []),
    testSetExternal_cases(?BER),

    ?ber_driver(?BER, asn1_test_lib:compile("External", Config, [?BER, driver])),
    ?ber_driver(?BER, testSetExternal:compile(Config, ?BER, [driver])),
    ?ber_driver(?BER, testSetExternal_cases(?BER)).

testSetExternal_cases(Rules) ->
    testSetExternal:main(Rules).


testSetOptional(suite) -> [];
testSetOptional(Config) ->
    testSetOptional:compile(Config, ?BER, []),
    testSetOptional_cases(?BER),

    ?ber_driver(?BER, testSetOptional:compile(Config, ?BER, [driver])),
    ?ber_driver(?BER, testSetOptional_cases(?BER)),

    testSetOptional:compile(Config, ?PER, []),
    testSetOptional_cases(?PER),

    ?per_bit_opt(testSetOptional:compile(Config, ?PER, [optimize])),
    ?per_bit_opt(testSetOptional_cases(?PER)),

    ?uper_bin(testSetOptional:compile(Config, uper_bin, [])),
    ?uper_bin(testSetOptional_cases(uper_bin)),

    testSetOptional:compile(Config, ?PER, [optimize]),
    testSetOptional_cases(?PER).

testSetOptional_cases(Rules) ->
    ok = testSetOptional:ticket_7533(Rules),
    ok = testSetOptional:main(Rules).




testSetPrim(suite) -> [];
testSetPrim(Config) ->
    testSetPrim:compile(Config, ?BER, []),
    testSetPrim_cases(?BER),

    ?ber_driver(?BER, testSetPrim:compile(Config, ?BER, [driver])),
    ?ber_driver(?BER, testSetPrim_cases(?BER)),

    testSetPrim:compile(Config, ?PER, []),
    testSetPrim_cases(?PER),

    ?per_bit_opt(testSetPrim:compile(Config, ?PER, [optimize])),
    ?per_bit_opt(testSetPrim_cases(?PER)),

    ?uper_bin(testSetPrim:compile(Config, uper_bin, [])),
    ?uper_bin(testSetPrim_cases(uper_bin)),

    testSetPrim:compile(Config, ?PER, [optimize]),
    testSetPrim_cases(?PER).

testSetPrim_cases(Rules) ->
    testSetPrim:main(Rules).



testSetTag(suite) -> [];
testSetTag(Config) ->
    asn1_test_lib:compile("External", Config, [?BER]),
    testSetTag:compile(Config, ?BER, []),
    testSetTag_cases(?BER),

    ?ber_driver(?BER, asn1_test_lib:compile("External", Config, [?BER, driver])),
    ?ber_driver(?BER, testSetTag:compile(Config, ?BER, [driver])),
    ?ber_driver(?BER, testSetTag_cases(?BER)),

    asn1_test_lib:compile("External", Config, [?PER]),
    testSetTag:compile(Config, ?PER, []),
    testSetTag_cases(?PER),

    ?per_bit_opt(asn1_test_lib:compile("External", Config, [?PER, optimize])),
    ?per_bit_opt(testSetTag:compile(Config, ?PER, [optimize])),
    ?per_bit_opt(testSetTag_cases(?PER)),

    ?uper_bin(asn1_test_lib:compile("External", Config, [uper_bin])),
    ?uper_bin(testSetTag:compile(Config, uper_bin, [])),
    ?uper_bin(testSetTag_cases(uper_bin)),

    asn1_test_lib:compile("External", Config, [?PER, optimize]),
    testSetTag:compile(Config, ?PER, [optimize]),
    testSetTag_cases(?PER).

testSetTag_cases(Rules) ->
    testSetTag:main(Rules).



testSetTypeRefCho(suite) -> [];
testSetTypeRefCho(Config) ->
    asn1_test_lib:compile("SetTypeRefCho", Config, [?BER]),
    testSetTypeRefCho_cases(?BER),

    ?ber_driver(?BER, asn1_test_lib:compile("SetTypeRefCho", Config, [?BER, driver])),
    ?ber_driver(?BER, testSetTypeRefCho_cases(?BER)),

    asn1_test_lib:compile("SetTypeRefCho", Config, [?PER]),
    testSetTypeRefCho_cases(?PER),

    ?per_bit_opt(asn1_test_lib:compile("SetTypeRefCho", Config, [?PER, optimize])),
    ?per_bit_opt(testSetTypeRefCho_cases(?PER)),

    ?uper_bin(asn1_test_lib:compile("SetTypeRefCho", Config, [uper_bin])),
    ?uper_bin(testSetTypeRefCho_cases(uper_bin)),

    asn1_test_lib:compile("SetTypeRefCho", Config, [?PER, optimize]),
    testSetTypeRefCho_cases(?PER).

testSetTypeRefCho_cases(Rules) ->
    testSetTypeRefCho:main(Rules).



testSetTypeRefPrim(suite) -> [];
testSetTypeRefPrim(Config) ->
    asn1_test_lib:compile("SetTypeRefPrim", Config, [?BER]),
    testSetTypeRefPrim_cases(?BER),

    ?ber_driver(?BER, asn1_test_lib:compile("SetTypeRefPrim", Config, [?BER, driver])),
    ?ber_driver(?BER, testSetTypeRefPrim_cases(?BER)),

    asn1_test_lib:compile("SetTypeRefPrim", Config, [?PER]),
    testSetTypeRefPrim_cases(?PER),

    ?per_bit_opt(asn1_test_lib:compile("SetTypeRefPrim", Config, [?PER, optimize])),
    ?per_bit_opt(testSetTypeRefPrim_cases(?PER)),

    ?uper_bin(asn1_test_lib:compile("SetTypeRefPrim", Config, [uper_bin])),
    ?uper_bin(testSetTypeRefPrim_cases(uper_bin)),

    asn1_test_lib:compile("SetTypeRefPrim", Config, [?PER, optimize]),
    testSetTypeRefPrim_cases(?PER).

testSetTypeRefPrim_cases(Rules) ->
    testSetTypeRefPrim:main(Rules).



testSetTypeRefSeq(suite) -> [];
testSetTypeRefSeq(Config) ->
    asn1_test_lib:compile("SetTypeRefSeq", Config, [?BER]),
    testSetTypeRefSeq_cases(?BER),

    ?ber_driver(?BER, asn1_test_lib:compile("SetTypeRefSeq", Config, [?BER, driver])),
    ?ber_driver(?BER, testSetTypeRefSeq_cases(?BER)),

    asn1_test_lib:compile("SetTypeRefSeq", Config, [?PER]),
    testSetTypeRefSeq_cases(?PER),

    ?per_bit_opt(asn1_test_lib:compile("SetTypeRefSeq", Config, [?PER, optimize])),
    ?per_bit_opt(testSetTypeRefSeq_cases(?PER)),

    ?uper_bin(asn1_test_lib:compile("SetTypeRefSeq", Config, [uper_bin])),
    ?uper_bin(testSetTypeRefSeq_cases(uper_bin)),

    asn1_test_lib:compile("SetTypeRefSeq", Config, [?PER, optimize]),
    testSetTypeRefSeq_cases(?PER).

testSetTypeRefSeq_cases(Rules) ->
    testSetTypeRefSeq:main(Rules).



testSetTypeRefSet(suite) -> [];
testSetTypeRefSet(Config) ->
    asn1_test_lib:compile("SetTypeRefSet", Config, [?BER]),
    testSetTypeRefSet_cases(?BER),

    ?ber_driver(?BER, asn1_test_lib:compile("SetTypeRefSet", Config, [?BER, driver])),
    ?ber_driver(?BER, testSetTypeRefSet_cases(?BER)),

    asn1_test_lib:compile("SetTypeRefSet", Config, [?PER]),
    testSetTypeRefSet_cases(?PER),

    ?per_bit_opt(asn1_test_lib:compile("SetTypeRefSet", Config, [?PER, optimize])),
    ?per_bit_opt(testSetTypeRefSet_cases(?PER)),

    ?uper_bin(asn1_test_lib:compile("SetTypeRefSet", Config, [uper_bin])),
    ?uper_bin(testSetTypeRefSet_cases(uper_bin)),

    asn1_test_lib:compile("SetTypeRefSet", Config, [?PER, optimize]),
    testSetTypeRefSet_cases(?PER).

testSetTypeRefSet_cases(Rules) ->
    testSetTypeRefSet:main(Rules).



testSetOf(suite) -> [];
testSetOf(Config) ->
    asn1_test_lib:compile("SetOf", Config, [?BER]),
    testSetOf_cases(?BER),

    ?ber_driver(?BER, asn1_test_lib:compile("SetOf", Config, [?BER, driver])),
    ?ber_driver(?BER, testSetOf_cases(?BER)),

    asn1_test_lib:compile("SetOf", Config, [?PER]),
    testSetOf_cases(?PER),

    ?per_bit_opt(asn1_test_lib:compile("SetOf", Config, [?PER, optimize])),
    ?per_bit_opt(testSetOf_cases(?PER)),

    ?uper_bin(asn1_test_lib:compile("SetOf", Config, [uper_bin])),
    ?uper_bin(testSetOf_cases(uper_bin)),

    asn1_test_lib:compile("SetOf", Config, [?PER, optimize]),
    testSetOf_cases(?PER).

testSetOf_cases(Rules) ->
    testSetOf:main(Rules).



testSetOfCho(suite) -> [];
testSetOfCho(Config) ->
    asn1_test_lib:compile("SetOfCho", Config, [?BER]),
    testSetOfCho_cases(?BER),

    ?ber_driver(?BER, asn1_test_lib:compile("SetOfCho", Config, [?BER, driver])),
    ?ber_driver(?BER, testSetOfCho_cases(?BER)),

    asn1_test_lib:compile("SetOfCho", Config, [?PER]),
    testSetOfCho_cases(?PER),

    ?per_bit_opt(asn1_test_lib:compile("SetOfCho", Config, [?PER, optimize])),
    ?per_bit_opt(testSetOfCho_cases(?PER)),

    ?uper_bin(asn1_test_lib:compile("SetOfCho", Config, [uper_bin])),
    ?uper_bin(testSetOfCho_cases(uper_bin)),

    asn1_test_lib:compile("SetOfCho", Config, [?PER, optimize]),
    testSetOfCho_cases(?PER).

testSetOfCho_cases(Rules) ->
    testSetOfCho:main(Rules).


testSetOfExternal(suite) -> [];
testSetOfExternal(Config) ->
    asn1_test_lib:compile("External", Config, [?BER]),
    asn1_test_lib:compile("SetOfExternal", Config, [?BER]),
    testSetOfExternal_cases(?BER),

    ?ber_driver(?BER, asn1_test_lib:compile("External", Config, [?BER, driver])),
    ?ber_driver(?BER, asn1_test_lib:compile("SetOfExternal", Config, [?BER, driver])),
    ?ber_driver(?BER, testSetOfExternal_cases(?BER)),

    asn1_test_lib:compile("External", Config, [?PER]),
    asn1_test_lib:compile("SetOfExternal", Config, [?PER]),
    testSetOfExternal_cases(?PER),

    ?per_bit_opt(asn1_test_lib:compile("External", Config, [?PER, optimize])),
    ?per_bit_opt(asn1_test_lib:compile("SetOfExternal", Config, [?PER, optimize])),
    ?per_bit_opt(testSetOfExternal_cases(?PER)),

    ?uper_bin(asn1_test_lib:compile("External", Config, [uper_bin])),
    ?uper_bin(asn1_test_lib:compile("SetOfExternal", Config, [uper_bin])),
    ?uper_bin(testSetOfExternal_cases(uper_bin)),

    asn1_test_lib:compile("External", Config, [?PER, optimize]),
    asn1_test_lib:compile("SetOfExternal", Config, [?PER, optimize]),
    testSetOfExternal_cases(?PER).

testSetOfExternal_cases(Rules) ->
    testSetOfExternal:main(Rules).




testSetOfTag(suite) -> [];
testSetOfTag(Config) ->
    asn1_test_lib:compile("External", Config, [?BER]),
    asn1_test_lib:compile("SetOfTag", Config, [?BER]),
    testSetOfTag_cases(?BER),

    ?ber_driver(?BER, asn1_test_lib:compile("External", Config, [?BER, driver])),
    ?ber_driver(?BER, asn1_test_lib:compile("SetOfTag", Config, [?BER, driver])),
    ?ber_driver(?BER, testSetOfTag_cases(?BER)),

    asn1_test_lib:compile("External", Config, [?PER]),
    asn1_test_lib:compile("SetOfTag", Config, [?PER]),
    testSetOfTag_cases(?PER),

    ?per_bit_opt(asn1_test_lib:compile("External", Config, [?PER, optimize])),
    ?per_bit_opt(asn1_test_lib:compile("SetOfTag", Config, [?PER, optimize])),
    ?per_bit_opt(testSetOfTag_cases(?PER)),

    ?uper_bin(asn1_test_lib:compile("External", Config, [uper_bin])),
    ?uper_bin(asn1_test_lib:compile("SetOfTag", Config, [uper_bin])),
    ?uper_bin(testSetOfTag_cases(uper_bin)),

    asn1_test_lib:compile("External", Config, [?PER, optimize]),
    asn1_test_lib:compile("SetOfTag", Config, [?PER, optimize]),
    testSetOfTag_cases(?PER).

testSetOfTag_cases(Rules) ->
    testSetOfTag:main(Rules).


sequence(suite) -> [{sequence, all}].

c_syntax(suite) -> [];
c_syntax(Config) ->
    DataDir%    asn1_test_lib:compile("External", Config, ?PER),
%    testPrimExternal:compile(Config, ?PER),
%    testPrimExternal_cases(?PER).
 = ?config(data_dir, Config),
    _TempDir = ?config(priv_dir, Config),
    {error, _R1} = asn1ct:compile(filename:join(DataDir, "Syntax")),
    {error, _R2} = asn1ct:compile(filename:join(DataDir, "BadTypeEnding")),
    {error, _R3} = asn1ct:compile(filename:join(DataDir,
                            "BadValueAssignment1")),
    {error, _R4} = asn1ct:compile(filename:join(DataDir,
                                                    "BadValueAssignment2")),
    {error, _R5} = asn1ct:compile(filename:join(DataDir,
                            "BadValueSet")),
    {error, _R6} = asn1ct:compile(filename:join(DataDir,
                            "ChoiceBadExtension")),
    {error, _R7} = asn1ct:compile(filename:join(DataDir,
                        "EnumerationBadExtension")),
    {error, _R8} = asn1ct:compile(filename:join(DataDir,
                            "Example")),
    {error, _R9} = asn1ct:compile(filename:join(DataDir,
                            "Export1")),
    {error, _R10} = asn1ct:compile(filename:join(DataDir,
                             "MissingEnd")),
    {error, _R11} = asn1ct:compile(filename:join(DataDir,
                             "SequenceBadComma")),
    {error, _R12} = asn1ct:compile(filename:join(DataDir,
                        "SequenceBadComponentName")),
    {error, _R13} = asn1ct:compile(filename:join(DataDir,
                        "SequenceBadComponentType")),
    {error, _R14} = asn1ct:compile(filename:join(DataDir,
                        "SeqBadComma")).


c_string_per(suite) -> [];
c_string_per(Config) ->
    asn1_test_lib:compile("String", Config, [?PER]).

c_string_ber(suite) -> [];
c_string_ber(Config) ->
    asn1_test_lib:compile("String", Config, [?BER]).


c_implicit_before_choice(suite) -> [];
c_implicit_before_choice(Config) ->
    DataDir = ?config(data_dir, Config),
    TempDir = ?config(priv_dir, Config),
    {error, _R2} = asn1ct:compile(filename:join(DataDir, "CCSNARG3"),
                                  [?BER, {outdir, TempDir}]).

parse(suite) -> [];
parse(Config) ->
    M1 = test_modules(),
    ok = parse1(M1, Config).

parse1([M|T], Config) ->
    asn1_test_lib:compile(M, Config, [abs]),
    parse1(T, Config);
parse1([], _) ->
    ok.

per(suite) -> [];
per(Config) ->
    CaseDir = ?config(case_dir, Config),
    ok = per1(per_modules(), Config, CaseDir),
    ?per_bit_opt(per1_bit_opt(per_modules(), Config, CaseDir)).


per1([M|T], Config, CaseDir) ->
    asn1_test_lib:compile(M, Config, [?PER]),
    ok = asn1ct:test(list_to_atom(M), [{i, CaseDir}]),
    per1(T, Config, CaseDir);
per1([], _, _) ->
    ok.

per1_bit_opt([M|T], Config, CaseDir) ->
    asn1_test_lib:compile(M, Config, [?PER, optimize]),
    ok = asn1ct:test(list_to_atom(M), [{i, CaseDir}]),
    per1_bit_opt(T, Config, CaseDir);
per1_bit_opt([], _, _) ->
    ok.

ber_choiceinseq(suite) ->[];
ber_choiceinseq(Config) ->
    asn1_test_lib:compile("ChoiceInSeq", Config, [?BER]).

ber_optional(suite) ->[];
ber_optional(Config) ->
    asn1_test_lib:compile("SOpttest", Config, [?BER]),

    V = {'S', {'A', 10, asn1_NOVALUE, asn1_NOVALUE},
              {'B', asn1_NOVALUE, asn1_NOVALUE, asn1_NOVALUE},
              {'C', asn1_NOVALUE, 111, asn1_NOVALUE}},
    {ok, B} = asn1_wrapper:encode('SOpttest', 'S', V),
    Bytes = lists:flatten(B),
    V2 = asn1_wrapper:decode('SOpttest', 'S', Bytes),
    V = element(2, V2).

ber_optional_keyed_list(suite) ->[];
ber_optional_keyed_list(Config) ->
    case ?BER of
        ber_bin_v2 ->
            ok;
        _ ->
            asn1_test_lib:compile("SOpttest", Config, [?BER, keyed_list]),
            Vrecord = {'S', {'A', 10,           asn1_NOVALUE, asn1_NOVALUE},
                            {'B', asn1_NOVALUE, asn1_NOVALUE, asn1_NOVALUE},
                            {'C', asn1_NOVALUE, 111,          asn1_NOVALUE}},
            V = [{a, [{scriptKey, 10}]},
                 {b, []},
                 {c, [{callingPartysCategory, 111}]}],
            {ok, B} = asn1_wrapper:encode('SOpttest', 'S', V),
            Bytes = lists:flatten(B),
            V2 = asn1_wrapper:decode('SOpttest', 'S', Bytes),
            Vrecord = element(2, V2)
    end.

ber_other(suite) ->[];
ber_other(Config) ->
    CaseDir = ?config(case_dir, Config),
    ok = ber1(ber_modules(), Config, CaseDir).


ber1([M|T], Config, CaseDir) ->
    asn1_test_lib:compile(M, Config, [?BER]),
    ok = asn1ct:test(list_to_atom(M), [{i, CaseDir}]),
    ber1(T, Config, CaseDir);
ber1([], _, _) ->
    ok.

default_per(suite) ->[];
default_per(Config) ->
    default1(Config, [?PER]).

default_per_opt(suite) -> [];
default_per_opt(Config) ->
    ?per_bit_opt(default1(Config, [?PER, optimize])),
    default1(Config, [?PER, optimize]).

default_ber(suite) ->[];
default_ber(Config) ->
    default1(Config, [?BER]).

default1(Config, Options) ->
    asn1_test_lib:compile("Def", Config, Options),

    {ok, Bytes1} = asn1_wrapper:encode('Def', 'Def1', #'Def1'{bool0 = true,
                                                              bool1 = true,
                                                              bool2 = true,
                                                              bool3 = true}),
    {ok, {'Def1', true, true, true, true}} =
        asn1_wrapper:decode('Def', 'Def1', lists:flatten(Bytes1)),

    {ok, Bytes2} = asn1_wrapper:encode('Def', 'Def1', #'Def1'{bool0 = true}),
    {ok, {'Def1', true, false, false, false}} =
        asn1_wrapper:decode('Def', 'Def1', lists:flatten(Bytes2)),

    {ok, Bytes3} = asn1_wrapper:encode('Def', 'Def1', #'Def1'{bool0 = true,
                                                              bool2 = false}),
    {ok, {'Def1', true, false, false, false}} =
        asn1_wrapper:decode('Def', 'Def1', lists:flatten(Bytes3)).


value_test(suite) ->[];
value_test(Config) ->
    asn1_test_lib:compile("ObjIdValues", Config, [?BER]),
    {ok, _} = asn1_wrapper:encode('ObjIdValues', 'ObjIdType', 'ObjIdValues':'mobileDomainId'()),
    asn1_test_lib:compile("ObjIdValues", Config, [?PER]),
    {ok, _} = asn1_wrapper:encode('ObjIdValues', 'ObjIdType', 'ObjIdValues':'mobileDomainId'()),
    ok = test_bad_values:tests(Config),
    ok.


constructed(suite) ->
     [];
constructed(Config) ->
    asn1_test_lib:compile("Constructed", Config, [?BER]),
    {ok, B} = asn1_wrapper:encode('Constructed', 'S', {'S', false}),
    [40, 3, 1, 1, 0] = lists:flatten(B),
    {ok, B1} = asn1_wrapper:encode('Constructed', 'S2', {'S2', false}),
    [40, 5, 48, 3, 1, 1, 0] = lists:flatten(B1),
    {ok, B2} = asn1_wrapper:encode('Constructed', 'I', 10),
    [136, 1, 10] = lists:flatten(B2),
    ok.

ber_decode_error(suite) -> [];
ber_decode_error(Config) ->
    asn1_test_lib:compile("Constructed", Config, [?BER]),
    ok = ber_decode_error:run([]),

    ?ber_driver(?BER, asn1_test_lib:compile("Constructed", Config, [?BER, driver])),
    ok = ?ber_driver(?BER, ber_decode_error:run([driver])),
    ok.

h323test(suite) ->
    [];
h323test(Config) ->
    Files = ["H235-SECURITY-MESSAGES",
             "H323-MESSAGES",
             "MULTIMEDIA-SYSTEM-CONTROL"],
    asn1_test_lib:compile_all(Files, Config, [?PER]),
    ok = h323test:run(?PER),
    ?per_bit_opt(asn1_test_lib:compile_all(Files, Config, [?PER, optimize])),
    ?per_bit_opt(h323test:run(?PER)),
    ?uper_bin(asn1_test_lib:compile_all(Files, Config, [uper_bin])),
    ?uper_bin(h323test:run(uper_bin)),
    ok = asn1_test_lib:compile_all(Files, Config, [?PER, optimize]),
    ok = h323test:run(?PER),
    ok.

per_GeneralString(suite) ->
     [];
per_GeneralString(Config) ->
    asn1_test_lib:compile("MULTIMEDIA-SYSTEM-CONTROL", Config, [?PER]),
    UI = [109, 64, 1, 57],
    {ok, _V} = asn1_wrapper:decode('MULTIMEDIA-SYSTEM-CONTROL',
                                   'MultimediaSystemControlMessage', UI).

per_open_type(suite) ->
    [];
per_open_type(Config) ->
    asn1_test_lib:compile("OpenType", Config, [?PER]),

    Stype = {'Stype', 10, true},
    {ok, Bytes} = asn1_wrapper:encode('OpenType', 'Ot', Stype),
    {ok, Stype} = asn1_wrapper:decode('OpenType', 'Ot', Bytes),

    ?per_bit_opt(asn1_test_lib:compile("OpenType", Config, [?PER, optimize])),
    ?per_bit_opt({ok, Bytes}=asn1_wrapper:encode('OpenType', 'Ot', Stype)),
    ?per_bit_opt({ok, Stype}=asn1_wrapper:decode('OpenType', 'Ot', Bytes)),

    ?uper_bin(asn1_test_lib:compile("OpenType", Config, [uper_bin])),
    ?uper_bin({ok, Bytes}=asn1_wrapper:encode('OpenType', 'Ot', Stype)),
    ?uper_bin({ok, Stype}=asn1_wrapper:decode('OpenType', 'Ot', Bytes)),

    asn1_test_lib:compile("OpenType", Config, [?PER, optimize]),
    {ok, Bytes} = asn1_wrapper:encode('OpenType', 'Ot', Stype),
    {ok, Stype} = asn1_wrapper:decode('OpenType', 'Ot', Bytes).

testConstraints(suite) ->
    [];
testConstraints(Config) ->
    asn1_test_lib:compile("Constraints", Config, [?BER]),
    testConstraints:int_constraints(?BER),

    ?ber_driver(?BER, asn1_test_lib:compile("Constraints", Config, [?BER, driver])),
    ?ber_driver(?BER, testConstraints:int_constraints(?BER)),

    asn1_test_lib:compile("Constraints", Config, [?PER]),
    testConstraints:int_constraints(?PER),
    testConstraints:refed_NNL_name(?PER),

    ?per_bit_opt(asn1_test_lib:compile("Constraints", Config, [?PER, optimize])),
    ?per_bit_opt(testConstraints:int_constraints(?PER)),
    ?per_bit_opt(testConstraints:refed_NNL_name(?PER)),

    ?uper_bin(asn1_test_lib:compile("Constraints", Config, [uper_bin])),
    ?uper_bin(testConstraints:int_constraints(uper_bin)),
    ?uper_bin(testConstraints:refed_NNL_name(uper_bin)),

    asn1_test_lib:compile("Constraints", Config, [?PER, optimize]),
    testConstraints:int_constraints(?PER),
    testConstraints:refed_NNL_name(?PER).

testSeqIndefinite(suite) -> [];
testSeqIndefinite(Config) ->
    asn1_test_lib:compile("SeqSetIndefinite", Config, [?BER]),
    testSeqIndefinite:main(?BER),

    ?ber_driver(?BER, asn1_test_lib:compile("SeqSetIndefinite", Config, [?BER, driver])),
    ?ber_driver(?BER, testSeqIndefinite:main(?BER)).

testSetIndefinite(suite) -> [];
testSetIndefinite(Config) ->
    asn1_test_lib:compile("SeqSetIndefinite", Config, [?BER]),
    testSetIndefinite:main(?BER),

    ?ber_driver(?BER, asn1_test_lib:compile("SeqSetIndefinite", Config, [?BER, driver])),
    ?ber_driver(?BER, testSetIndefinite:main(?BER)).

testChoiceIndefinite(suite) -> [];
testChoiceIndefinite(Config) ->
    testChoiceIndefinite:compile(Config, ?BER, []),
    testChoiceIndefinite:main(?BER),

    ?ber_driver(?BER, testChoiceIndefinite:compile(Config, ?BER, [driver])),
    ?ber_driver(?BER, testChoiceIndefinite:main(?BER)).

testInfObjectClass(suite) ->
    [];
testInfObjectClass(Config) ->
    Files = ["ErrorClass", "InfClass"],
    InfObjFiles = ["RANAPextract1", "InfObj", "MAP-ExtensionDataTypes",
                   "Objects", "INAPv2extract"],
    RANAPFiles = ["RANAP-CommonDataTypes", "RANAP-Constants",
                  "RANAP-Containers", "RANAP-IEs", "RANAP-PDU-Contents",
                  "RANAP-PDU-Descriptions"],
    asn1_test_lib:compile_all(Files, Config, [?PER]),
    testInfObjectClass:main(?PER),
    asn1_test_lib:compile_all(InfObjFiles, Config, [?PER]),
    testInfObj:main(?PER),

    ?uper_bin(asn1_test_lib:compile_all(Files, Config, [uper_bin])),
    ?uper_bin(testInfObjectClass:main(uper_bin)),
    ?uper_bin(asn1_test_lib:compile_all(InfObjFiles, Config, [uper_bin])),
    ?uper_bin(testInfObj:main(uper_bin)),

    asn1_test_lib:compile_all(Files, Config, [?PER, optimize]),
    testInfObjectClass:main(?PER),
    asn1_test_lib:compile_all(InfObjFiles, Config, [?PER, optimize]),
    testInfObj:main(?PER),

    asn1_test_lib:compile_all(Files, Config, [?BER]),
    testInfObjectClass:main(?BER),
    asn1_test_lib:compile_all(InfObjFiles, Config, [?BER]),
    testInfObj:main(?BER),

    ?ber_driver(?BER, asn1_test_lib:compile_all(Files, Config, [?BER, driver])),
    ?ber_driver(?BER, testInfObjectClass:main(?BER)),
    ?ber_driver(?BER, asn1_test_lib:compile_all(InfObjFiles, Config, [?BER, driver])),
    ?ber_driver(?BER, testInfObj:main(?BER)),

    asn1_test_lib:compile_all(RANAPFiles, Config, [?PER]),

    ?uper_bin(asn1_test_lib:compile_all(RANAPFiles, Config, [uper_bin])),

    asn1_test_lib:compile_all(RANAPFiles, Config, [?PER, optimize]),

    asn1_test_lib:compile_all(RANAPFiles, Config, [?BER]).

testParameterizedInfObj(suite) ->
    [];
testParameterizedInfObj(Config) ->
    asn1_test_lib:compile("Param", Config, [?PER]),
    testParameterizedInfObj:main(?PER),

    % TODO: Remove all ?per_bit_opt(...) which has an equiv without macro
    ?per_bit_opt(asn1_test_lib:compile("Param", Config, [?PER, optimize])),
    ?per_bit_opt(testParameterizedInfObj:main(?PER)),

    ?uper_bin(asn1_test_lib:compile("Param", Config, [uper_bin])),
    ?uper_bin(testParameterizedInfObj:main(uper_bin)),

    asn1_test_lib:compile("Param", Config, [?PER, optimize]),
    testParameterizedInfObj:main(?PER),

    asn1_test_lib:compile("Param", Config, [?BER]),
    testParameterizedInfObj:main(?BER),

    ?ber_driver(?BER, asn1_test_lib:compile("Param", Config, [?BER, driver])),
    ?ber_driver(?BER, testParameterizedInfObj:main(?BER)).

testMergeCompile(suite) ->
    [];
testMergeCompile(Config) ->
    Files = ["MS.set.asn", "RANAPSET.set.asn1", "Mvrasn4.set.asn",
             "Mvrasn6.set.asn"],
    asn1_test_lib:compile_all(Files, Config, [?PER]),
    testMergeCompile:main(?PER),
    testMergeCompile:mvrasn(?PER),

    ?per_bit_opt(asn1_test_lib:compile_all(Files, Config, [?PER, optimize])),
    ?per_bit_opt(testMergeCompile:main(?PER)),
    ?per_bit_opt(testMergeCompile:mvrasn(?PER)),

    ?uper_bin(asn1_test_lib:compile_all(Files, Config, [uper_bin])),
    ?uper_bin(testMergeCompile:main(uper_bin)),
    ?uper_bin(testMergeCompile:mvrasn(uper_bin)),

    asn1_test_lib:compile_all(Files, Config, [?BER]),
    testMergeCompile:main(?BER),
    testMergeCompile:mvrasn(?BER),

    ?ber_driver(?BER, asn1_test_lib:compile_all(Files, Config, [?BER, driver])),
    ?ber_driver(?BER, testMergeCompile:main(?BER)),
    ?ber_driver(?BER, testMergeCompile:mvrasn(?BER)).

testobj(suite) ->
    [];
testobj(Config) ->
    ok = testRANAP:compile(Config, [?PER]),
    ok = testRANAP:testobj(?PER),
    ok = testParameterizedInfObj:ranap(?PER),

    ?per_bit_opt(ok = testRANAP:compile(Config, [?PER, optimize])),
    ?per_bit_opt(ok = testRANAP:testobj(?PER)),
    ?per_bit_opt(ok = testParameterizedInfObj:ranap(?PER)),

    ?uper_bin(ok = testRANAP:compile(Config, [uper_bin])),
    ?uper_bin(ok = testRANAP:testobj(uper_bin)),
    ?uper_bin(ok = testParameterizedInfObj:ranap(uper_bin)),

    ok = testRANAP:compile(Config, [?PER, optimize]),
    ok = testRANAP:testobj(?PER),
    ok = testParameterizedInfObj:ranap(?PER),

    ok = testRANAP:compile(Config, [?BER]),
    ok = testRANAP:testobj(?BER),
    ok = testParameterizedInfObj:ranap(?BER),

    ?ber_driver(?BER, testRANAP:compile(Config, [?BER, driver])),
    ?ber_driver(?BER, testRANAP:testobj(?BER)),
    ?ber_driver(?BER, testParameterizedInfObj:ranap(?BER)).


testDeepTConstr(suite) ->
    [];
testDeepTConstr(Config) ->
    asn1_test_lib:compile("TConstrChoice", Config, [?PER]),
    asn1_test_lib:compile("TConstr", Config, [?PER]),
    testDeepTConstr:main(?PER),

    ?per_bit_opt(asn1_test_lib:compile("TConstrChoice", Config, [?PER, optimize])),
    ?per_bit_opt(asn1_test_lib:compile("TConstr", Config, [?PER, optimize])),
    ?per_bit_opt(testDeepTConstr:main(?PER)),

    ?uper_bin(asn1_test_lib:compile("TConstrChoice", Config, [uper_bin])),
    ?uper_bin(asn1_test_lib:compile("TConstr", Config, [uper_bin])),
    ?uper_bin(testDeepTConstr:main(uper_bin)),

    asn1_test_lib:compile("TConstrChoice", Config, [?PER, optimize]),
    asn1_test_lib:compile("TConstr", Config, [?PER, optimize]),
    testDeepTConstr:main(?PER),

    asn1_test_lib:compile("TConstrChoice", Config, [?BER]),
    asn1_test_lib:compile("TConstr", Config, [?BER]),
    testDeepTConstr:main(?BER),

    ?ber_driver(?BER, asn1_test_lib:compile("TConstrChoice", Config, [?BER, driver])),
    ?ber_driver(?BER, asn1_test_lib:compile("TConstr", Config, [?BER, driver])),
    ?ber_driver(?BER, testDeepTConstr:main(?BER)).

testInvokeMod(suite) ->
    [];
testInvokeMod(Config) ->
    asn1_test_lib:compile("PrimStrings", Config, []),
    {ok, _Result1} = 'PrimStrings':encode('Bs1', [1, 0, 1, 0]),
    asn1_test_lib:compile("PrimStrings", Config, [?PER]),
    {ok, _Result2} = 'PrimStrings':encode('Bs1', [1, 0, 1, 0]).

testExport(suite) ->
    [];
testExport(Config) ->
    DataDir = ?config(data_dir, Config),
    CaseDir = ?config(case_dir, Config),
    {error, {asn1, _Reason}} =
        asn1ct:compile(filename:join(DataDir, "IllegalExport"),
                       [{outdir, CaseDir}]).

testImport(suite) ->
    [];
testImport(Config) ->
    DataDir = ?config(data_dir, Config),
    CaseDir = ?config(priv_dir, Config),
    {error, _} = asn1ct:compile(filename:join(DataDir, "ImportsFrom"),
                                [?BER, {outdir, CaseDir}]).

testMegaco(suite) ->
    [];
testMegaco(Config) ->
    {ok, ModuleName1, ModuleName2} = testMegaco:compile(Config, ?BER, []),
    ok = testMegaco:main(ModuleName1, Config),
    ok = testMegaco:main(ModuleName2, Config),

    case ?BER of
        ber_bin_v2 ->
            {ok, ModuleName3, ModuleName4} = testMegaco:compile(Config, ?BER, [driver]),
            ok = testMegaco:main(ModuleName3, Config),
            ok = testMegaco:main(ModuleName4, Config);
        _->
            ok
    end,

    {ok, ModuleName5, ModuleName6} = testMegaco:compile(Config, ?PER, []),
    ok = testMegaco:main(ModuleName5, Config),
    ok = testMegaco:main(ModuleName6, Config),

    ?per_bit_opt({ok, ModuleName5, ModuleName6} = testMegaco:compile(Config, ?PER, [optimize])),
    ?per_bit_opt(ok = testMegaco:main(ModuleName5, Config)),
    ?per_bit_opt(ok = testMegaco:main(ModuleName6, Config)),

    ?uper_bin({ok, ModuleName5, ModuleName6} = testMegaco:compile(Config, uper_bin, [])),
    ?uper_bin(ok = testMegaco:main(ModuleName5, Config)),
    ?uper_bin(ok = testMegaco:main(ModuleName6, Config)),

    {ok, ModuleName7, ModuleName8} = testMegaco:compile(Config, ?PER, [optimize]),
    ok = testMegaco:main(ModuleName7, Config),
    ok = testMegaco:main(ModuleName8, Config).


testMvrasn6(suite) -> [];
testMvrasn6(Config) ->
    asn1_test_lib:compile("Mvrasn-21-4", Config, [?BER]),
    asn1_test_lib:compile("Mvrasn-20-6", Config, [?BER]),
    asn1_test_lib:compile("Mvrasn-19-6", Config, [?BER]),
    asn1_test_lib:compile("Mvrasn-15-6", Config, [?BER]),
    asn1_test_lib:compile("Mvrasn-18-6", Config, [?BER]),
    asn1_test_lib:compile("Mvrasn-14-6", Config, [?BER]),
    asn1_test_lib:compile("Mvrasn-11-6", Config, [?BER]).

testContextSwitchingTypes(suite) -> [];
testContextSwitchingTypes(Config) ->
    asn1_test_lib:compile("ContextSwitchingTypes", Config, [?BER]),
    testContextSwitchingTypes:test(Config),

    ?ber_driver(?BER, asn1_test_lib:compile("ContextSwitchingTypes", Config, [?BER, driver])),
    ?ber_driver(?BER, testContextSwitchingTypes:test(Config)),

    asn1_test_lib:compile("ContextSwitchingTypes", Config, [?PER]),
    testContextSwitchingTypes:test(Config),

    ?per_bit_opt(asn1_test_lib:compile("ContextSwitchingTypes", Config, [?PER, optimize])),
    ?per_bit_opt(testContextSwitchingTypes:test(Config)),

    ?uper_bin(asn1_test_lib:compile("ContextSwitchingTypes", Config, [uper_bin])),
    ?uper_bin(testContextSwitchingTypes:test(Config)),

    asn1_test_lib:compile("ContextSwitchingTypes", Config, [?PER, optimize]),
    testContextSwitchingTypes:test(Config).

testTypeValueNotation(suite) -> [];
testTypeValueNotation(Config) ->
    Files = ["SeqTypeRefPrim",
             "ValueTest"], % OTP-6695
    case ?BER of
        Ber when Ber == ber; Ber == ber_bin ->
            asn1_test_lib:compile_all(Files, Config, [?BER]),
            testTypeValueNotation:main(?BER, dummy);
        _ ->
            ok
    end,

    ?ber_driver(?BER, asn1_test_lib:compile_all(Files, Config, [?BER, driver])),
    ?ber_driver(?BER, testTypeValueNotation:main(?BER, optimize)),

    case ?BER of
    Ber2 when Ber2 == ber; Ber2 == ber_bin ->
        asn1_test_lib:compile_all(Files, Config, [?PER]),
        testTypeValueNotation:main(?PER, dummy);
    _ ->
        ok
    end,

    ?per_bit_opt(asn1_test_lib:compile_all(Files, Config, [?PER, optimize])),
    ?per_bit_opt(testTypeValueNotation:main(?PER, optimize)),

    ?uper_bin(asn1_test_lib:compile_all(Files, Config, [uper_bin])),
    ?uper_bin(testTypeValueNotation:main(uper_bin, optimize)),
    case ?BER of
    Ber3 when Ber3 == ber; Ber3 == ber_bin ->
        asn1_test_lib:compile_all(Files, Config, [?PER, optimize]),
        testTypeValueNotation:main(?PER, optimize);
    _ ->
        ok
     end.

testOpenTypeImplicitTag(suite) -> [];
testOpenTypeImplicitTag(Config) ->
    asn1_test_lib:compile("OpenTypeImplicitTag", Config, [?BER]),
    testOpenTypeImplicitTag:main(?BER),

    ?ber_driver(?BER, asn1_test_lib:compile("OpenTypeImplicitTag", Config, [?BER, driver])),
    ?ber_driver(?BER, testOpenTypeImplicitTag:main(?BER)),

    asn1_test_lib:compile("OpenTypeImplicitTag", Config, [?PER]),
    testOpenTypeImplicitTag:main(?PER),

    ?per_bit_opt(asn1_test_lib:compile("OpenTypeImplicitTag", Config, [?PER, optimize])),
    ?per_bit_opt(testOpenTypeImplicitTag:main(?PER)),

    ?uper_bin(asn1_test_lib:compile("OpenTypeImplicitTag", Config, [uper_bin])),
    ?uper_bin(testOpenTypeImplicitTag:main(uper_bin)),

    asn1_test_lib:compile("OpenTypeImplicitTag", Config, [?PER, optimize]),
    testOpenTypeImplicitTag:main(?PER).

duplicate_tags(suite) -> [];
duplicate_tags(Config) ->
    DataDir = ?config(data_dir, Config),
    CaseDir = ?config(case_dir, Config),
    {error, {asn1, [{error, {type, _, _, 'SeqOpt1Imp', {asn1, {duplicates_of_the_tags, _}}}}]}} =
    asn1ct:compile(filename:join(DataDir, "SeqOptional2"),
                   [abs, {outdir, CaseDir}]).

rtUI(suite) -> [];
rtUI(Config) ->
    asn1_test_lib:compile("Prim", Config, [?BER]),
    {ok, _} = asn1rt:info('Prim'),
    asn1_test_lib:compile("Prim", Config, [?PER]),
    {ok, _} = asn1rt:info('Prim').

testROSE(suite) -> [];
testROSE(Config) ->
    asn1_test_lib:compile("Remote-Operations-Merged.set.asn1", Config, [?BER]),
    asn1_test_lib:compile("Remote-Operations-Merged.set.asn1", Config, [?PER]),
    ?per_bit_opt(asn1_test_lib:compile("Remote-Operations-Merged.set.asn1", Config, [?PER, optimize])),
    ?uper_bin(asn1_test_lib:compile("Remote-Operations-Merged.set.asn1", Config, [uper_bin])),
    asn1_test_lib:compile("Remote-Operations-Merged.set.asn1", Config, [?PER, optimize]).

testINSTANCE_OF(suite) -> [];
testINSTANCE_OF(Config) ->
    asn1_test_lib:compile("INSTANCEOF.asn1", Config, [?BER]),
    testINSTANCE_OF:main(?BER),

    ?ber_driver(?BER, asn1_test_lib:compile("INSTANCEOF.asn1", Config, [?BER, driver])),
    ?ber_driver(?BER, testINSTANCE_OF:main(?BER)),

    asn1_test_lib:compile("INSTANCEOF.asn1", Config, [?PER]),
    testINSTANCE_OF:main(?PER),

    ?per_bit_opt(asn1_test_lib:compile("INSTANCEOF.asn1", Config, [?PER, optimize])),
    ?per_bit_opt(testINSTANCE_OF:main(?PER)),

    ?uper_bin(asn1_test_lib:compile("INSTANCEOF.asn1", Config, [uper_bin])),
    ?uper_bin(testINSTANCE_OF:main(uper_bin)),

    asn1_test_lib:compile("INSTANCEOF.asn1", Config, [?PER, optimize]),
    testINSTANCE_OF:main(?PER).

testTCAP(suite) -> [];
testTCAP(Config) ->
    testTCAP:compile(Config, [?BER]),
    testTCAP:test(?BER, Config),

    ?ber_driver(?BER, testTCAP:compile(Config, [?BER, driver])),
    ?ber_driver(?BER, testTCAP:test(?BER, Config)),

    ?ber_driver(?BER, testTCAP:compile_asn1config(Config, [?BER, asn1config])),
    ?ber_driver(?BER, testTCAP:test_asn1config()).

testDER(suite) ->[];
testDER(Config) ->
    asn1_test_lib:compile("DERSpec", Config, [?BER, der]),
    testDER:test(),

    ?ber_driver(?BER, asn1_test_lib:compile("DERSpec", Config, [?BER, der, driver])),
    ?ber_driver(?BER, testDER:test()),

    asn1_test_lib:compile("ParamBasic", Config, [?BER, der]),
    testParamBasic_cases(der),

    asn1_test_lib:compile("Default", Config, [?BER, der]),
    testSeqSetDefaultVal_cases(?BER).

testSeqSetDefaultVal_cases(?BER) ->
    testSeqSetDefaultVal:main(?BER).


specialized_decodes(suite) -> [];
specialized_decodes(Config) ->
    case ?BER of
        ber_bin_v2 ->
            asn1_test_lib:compile_all(["PartialDecSeq.asn",
                                       "PartialDecSeq2.asn",
                                       "PartialDecSeq3.asn",
                                       "PartialDecMyHTTP.asn",
                                       "MEDIA-GATEWAY-CONTROL.asn",
                                       "P-Record"],
                                      Config, [?BER, optimize, asn1config]),
            test_partial_incomplete_decode:test(Config),
            test_selective_decode:test();
        Rule ->
            {skip, lists:concat(["not implemented yet for version: ", Rule])}
    end.

special_decode_performance(suite) ->[];
special_decode_performance(Config) ->
    Files = ["MEDIA-GATEWAY-CONTROL", "PartialDecSeq"],
    ?ber_driver(?BER, asn1_test_lib:compile_all(Files, Config,
                                                [?BER, optimize, asn1config])),
    ?ber_driver(?BER, test_special_decode_performance:go(all)).


test_driver_load(suite) -> [];
test_driver_load(Config) ->
    case ?PER of
        per_bin ->
            asn1_test_lib:compile("P-Record", Config, [?PER, optimize]),
            test_driver_load:test(5);
        _ ->
            ok
    end.

test_ParamTypeInfObj(suite) -> [];
test_ParamTypeInfObj(Config) ->
    asn1_test_lib:compile("IN-CS-1-Datatypes", Config, [ber_bin]).

test_WS_ParamClass(suite) -> [];
test_WS_ParamClass(Config) ->
    asn1_test_lib:compile("InformationFramework", Config, [ber_bin]).

test_Defed_ObjectIdentifier(suite) -> [];
test_Defed_ObjectIdentifier(Config) ->
    asn1_test_lib:compile("UsefulDefinitions", Config, [ber_bin]).

testSelectionType(suite) -> [];
testSelectionType(Config) ->
    asn1_test_lib:compile("SelectionType", Config, [?BER]),
    {ok, _}  = testSelectionTypes:test(),
    asn1_test_lib:compile("SelectionType", Config, [?PER]),
    {ok, _}  = testSelectionTypes:test().

testSSLspecs(suite) -> [];
testSSLspecs(Config) ->
    ok = testSSLspecs:compile(Config,
                              [?BER, optimize, compact_bit_string, der]),
    testSSLspecs:run(?BER),

    case code:which(asn1ct) of
       cover_compiled ->
           ok;
       _ ->
           ok = testSSLspecs:compile_inline(Config, ?BER),
           ok = testSSLspecs:run_inline(?BER)
    end.

testNortel(suite) -> [];
testNortel(Config) ->
    asn1_test_lib:compile("Nortel", Config, [?BER]),
    asn1_test_lib:compile("Nortel", Config, [?BER, optimize]),
    asn1_test_lib:compile("Nortel", Config, [?BER, optimize, driver]),
    asn1_test_lib:compile("Nortel", Config, [?PER]),
    ?per_bit_opt(asn1_test_lib:compile("Nortel", Config, [?PER, optimize])),
    ?uper_bin(asn1_test_lib:compile("Nortel", Config, [uper_bin])),
    asn1_test_lib:compile("Nortel", Config, [?PER, optimize]).

test_undecoded_rest(suite) -> [];
test_undecoded_rest(Config) ->
    asn1_test_lib:compile("P-Record", Config, [?BER]),
    ok = test_undecoded_rest:test([], Config),

    asn1_test_lib:compile("P-Record", Config, [?BER, undec_rest]),
    ok = test_undecoded_rest:test(undec_rest, Config),

    asn1_test_lib:compile("P-Record", Config, [?PER]),
    ok = test_undecoded_rest:test([], Config),

    ?per_bit_opt(asn1_test_lib:compile("P-Record", Config, [?PER, optimize, undec_rest])),
    ?per_bit_opt(ok = test_undecoded_rest:test(undec_rest, Config)),

    ?uper_bin(asn1_test_lib:compile("P-Record", Config, [uper_bin, undec_rest])),
    ?uper_bin(ok = test_undecoded_rest:test(undec_rest, Config)),

    asn1_test_lib:compile("P-Record", Config, [?PER, undec_rest]),
    ok = test_undecoded_rest:test(undec_rest, Config).

test_inline(suite) -> [];
test_inline(Config) ->
    case code:which(asn1ct) of
       cover_compiled ->
          {skip, "Not runnable when cover compiled"};
       _  ->
          ok=test_inline:compile(Config, []),
          test_inline:main(Config, ?BER),
          test_inline:inline1(Config, ?BER, []),
          test_inline:performance2()
    end.

%test_inline_prf(suite) -> [];
%test_inline_prf(Config) ->
%    test_inline:performance(Config).

testTcapsystem(suite) -> [];
testTcapsystem(Config) ->
    testTcapsystem:compile(Config, [?BER]).

testNBAPsystem(suite) -> [];
testNBAPsystem(Config) ->
    ok=testNBAPsystem:compile(Config, [?PER|?per_optimize(?BER)]),
    ok=testNBAPsystem:test(?PER, Config).

test_compile_options(suite) -> [];
test_compile_options(Config) ->
    case code:which(asn1ct) of
       cover_compiled ->
          {skip, "Not runnable when cover compiled"};
       _  ->
          ok = test_compile_options:wrong_path(Config),
          ok = test_compile_options:path(Config),
          ok = test_compile_options:noobj(Config),
      ok = test_compile_options:record_name_prefix(Config),
      ok = test_compile_options:verbose(Config),
      ok = test_compile_options:warnings_as_errors(Config)
    end.

testDoubleEllipses(suite) ->  [];
testDoubleEllipses(Config) ->
    asn1_test_lib:compile("DoubleEllipses", Config, [?BER]),
    testDoubleEllipses:main(?BER),
    ?ber_driver(?BER, asn1_test_lib:compile("DoubleEllipses", Config, [?BER, driver])),
    ?ber_driver(?BER, testDoubleEllipses:main(?BER)),
    ?per_bit_opt(asn1_test_lib:compile("DoubleEllipses", Config, [?PER, optimize])),
    ?per_bit_opt(testDoubleEllipses:main(?PER)),
    ?uper_bin(asn1_test_lib:compile("DoubleEllipses", Config, [uper_bin])),
    ?uper_bin(testDoubleEllipses:main(uper_bin)),
    asn1_test_lib:compile("DoubleEllipses", Config, [?PER|?per_optimize(?BER)]),
    testDoubleEllipses:main(?PER).

test_modified_x420(suite) -> [];
test_modified_x420(Config) ->
    test_modified_x420:compile(Config),
    test_modified_x420:test_io(Config).

testX420(suite) -> [];
testX420(Config) ->
    testX420:compile(?BER, [der], Config),
    ok = testX420:ticket7759(?BER, Config),
    testX420:compile(?PER, [], Config).

test_x691(suite) -> [];
test_x691(Config) ->
    case ?PER of
        per ->
            ok   = test_x691:compile(Config, [uper_bin]),
            true = test_x691:cases(uper_bin, unaligned),
            ok   = test_x691:compile(Config, [?PER]),
            true = test_x691:cases(?PER, aligned),
            ok   = asn1_test_lib:ticket_7708(Config, []),
            ok   = asn1_test_lib:ticket_7763(Config);
        _ ->
            ok   = test_x691:compile(Config, [?PER|?per_optimize(?BER)]),
            true = test_x691:cases(?PER, aligned)
    end.

ticket_6143(suite) -> [];
ticket_6143(Config) ->
    ok = test_compile_options:ticket_6143(Config).

testExtensionAdditionGroup(suite) -> [];
testExtensionAdditionGroup(Config) ->
    DataDir = ?config(data_dir, Config),
    PrivDir = ?config(priv_dir, Config),
    Path = code:get_path(),
    DoIt = fun(Erule) ->
        ok = asn1ct:compile(filename:join(DataDir, "Extension-Addition-Group"), Erule ++ [{outdir, PrivDir}]),
        {ok, _M} = compile:file(filename:join(DataDir, "extensionAdditionGroup"), [{i, PrivDir}, {outdir, PrivDir}, debug_info]),
        ok = extensionAdditionGroup:run(Erule),
            ok = extensionAdditionGroup:run2(Erule),
        ok = asn1ct:compile(filename:join(DataDir, "EUTRA-RRC-Definitions"), Erule ++ [{record_name_prefix, "RRC-"}, {outdir, PrivDir}]),
        ok = extensionAdditionGroup:run3(Erule)
           end,
    [DoIt(Rule)|| Rule <- [[per_bin], [per_bin, optimize], [uper_bin]]],
    %% FIXME problems with automatic tags [ber_bin], [ber_bin, optimize]
    code:set_path(Path).



% parse_modules() ->
%   ["ImportsFrom"].

per_modules() ->
    [X || X <- test_modules()].
ber_modules() ->
    [X || X <- test_modules(),
        X =/= "CommonDataTypes",
        X =/= "DS-EquipmentUser-CommonFunctionOrig-TransmissionPath",
        X =/= "H323-MESSAGES",
            X =/= "H235-SECURITY-MESSAGES",
            X =/= "MULTIMEDIA-SYSTEM-CONTROL"].
test_modules() ->
    _Modules = [
           "BitStr",
           "CAP",
           "CommonDataTypes",
           "Constraints",
           "ContextSwitchingTypes",
           "DS-EquipmentUser-CommonFunctionOrig-TransmissionPath",
           "Enum",
           "From",
           "H235-SECURITY-MESSAGES",
           "H323-MESSAGES",
           %%"MULTIMEDIA-SYSTEM-CONTROL", recursive type , problem for asn1ct:value
           "Import",
           "Int",
           "MAP-commonDataTypes",
% ambigous tags        "MAP-insertSubscriberData-def",
           "Null",
           "Octetstr",
           "One",
           "P-Record",
           "P",
%          "PDUs",
           "Person",
           "PrimStrings",
           "Real",
           "XSeq",
           "XSeqOf",
           "XSet",
           "XSetOf",
           "String",
           "SwCDR",
%          "Syntax",
           "Time"
% ANY          "Tst",
%          "Two",
% errors that should be detected      "UndefType"
] ++
    [
     "SeqSetLib", % must be compiled before Seq and Set
     "Seq",
     "Set",
     "SetOf",
     "SeqOf",
     "Prim",
     "Cho",
     "Def",
         "Opt",
     "ELDAPv3",
     "LDAP"
    ].

test_OTP_9688(Config) ->
    Asn1Mod = "OTP-9688.asn1",
    %%DataDir = ?config(data_dir,Config),     
    PrivDir = ?config(priv_dir,Config),
    Data = "
OTP-9688 DEFINITIONS ::= BEGIN

 foo INTEGER ::= 1
 bar INTEGER ::= 42

 Baz ::= INTEGER {x-y-z1(foo), x-y-z2(bar)}
 Qux ::= SEQUENCE {flerpInfo SEQUENCE {x INTEGER (-10 | -9 | (0..4))} OPTIONAL}

END
",
    File = filename:join(PrivDir,Asn1Mod),
    ok = file:write_file(File, Data),
    %% Does it compile with changes to asn1ct_check and asn1ct_gen_per_rt2ct?
    %% (see ticket)
    ok = asn1ct:compile(File, [{outdir, PrivDir}]).