(js_code, input_data)
| 16 | return "" |
| 17 | |
| 18 | def run_javascript_code(js_code, input_data): |
| 19 | with open("temp.js", "w") as f: |
| 20 | f.write(js_code) |
| 21 | try: |
| 22 | process = subprocess.run( |
| 23 | ["node", "temp.js"], |
| 24 | input=input_data.encode(), |
| 25 | capture_output=True, |
| 26 | text=True, |
| 27 | ) |
| 28 | return process.stdout.strip() |
| 29 | except Exception as e: |
| 30 | print(f"Error running JavaScript code: {str(e)}") |
| 31 | return "" |
| 32 | |
| 33 | def evaluate_translation(python_code, js_code, test_cases): |
| 34 | matches = 0 |
no outgoing calls
no test coverage detected