File tree Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Expand file tree Collapse file tree 1 file changed +44
-0
lines changed Original file line number Diff line number Diff line change @@ -161,3 +161,47 @@ for i, result in enumerate(results):
161161    print (result.stdout)
162162    print (result.status)
163163``` 
164+ 
165+ ### Test Cases And Multiple Languages  
166+ 
167+ ``` python 
168+ import  judge0
169+ 
170+ submissions =  [
171+     judge0.Submission(
172+         source_code = " print(f'Hello, {input()}!')"  ,
173+         language = judge0.PYTHON ,
174+     ),
175+     judge0.Submission(
176+         source_code = """ 
177+ #include <stdio.h> 
178+ 
179+ int main() { 
180+     char name[10]; 
181+     scanf("%s ", name); 
182+     printf("Hello, %s !\\ n", name); 
183+     return 0; 
184+ } 
185+ """  ,
186+         language = judge0.C,
187+     ),
188+ ]
189+ 
190+ test_cases= [
191+     (" Bob"  , " Hello, Bob!"  ),
192+     (" Alice"  , " Hello, Alice!"  ),
193+     (" Charlie"  , " Hello, Charlie!"  ),
194+ ]
195+ 
196+ results =  judge0.run(submissions = submissions, test_cases = test_cases)
197+ 
198+ for  i in  range (len (submissions)):
199+     print (f " --- Submission # { i +  1 }  --- " )
200+ 
201+     for  j in  range (len (test_cases)):
202+         result =  results[i *  len (test_cases) +  j]
203+ 
204+         print (f " --- Test Case # { j +  1 }  --- " )
205+         print (result.stdout)
206+         print (result.status)
207+ ``` 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments