|
|
--- |
|
|
license: mit |
|
|
language: |
|
|
- code |
|
|
tags: |
|
|
- rust |
|
|
- go |
|
|
- julia |
|
|
- code |
|
|
- test-generation |
|
|
- low-resource-languages |
|
|
- unit-tests |
|
|
- benchmark |
|
|
pretty_name: TestEval-LR |
|
|
size_categories: |
|
|
- 1K<n<10K |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dataset_summary: | |
|
|
TestEval-LR is a benchmark dataset for evaluating unit test generation capabilities of models on low-resource programming languages (Rust, Go, and Julia). Each sample provides a focal function's source code and metadata for generating idiomatic test code. |
|
|
--- |
|
|
|
|
|
# π TestEval-LR: Unit Test Generation Benchmark for Low-Resource Languages |
|
|
|
|
|
TestEval-LR is a **validation benchmark** designed to measure how well models can generate unit tests for **Low-Resource Programming Languages (LRPLs)** β specifically **Rust**, **Go**, and **Julia**. |
|
|
|
|
|
## π Purpose |
|
|
Evaluate how well a model can generate test code, given a focal function's source code and context. |
|
|
|
|
|
## π Dataset Structure |
|
|
Each example contains: |
|
|
- **function_name**: Name of the focal function. |
|
|
- **focal_code**: Raw source code of the function (used for context). |
|
|
- **function_component**: Detail information about the function like function signature,arguments definition,line range,... |
|
|
- **file_content**: Content of file have the focal function. |
|
|
- **file_path**: Relative path to the file in the repository. |
|
|
|
|
|
|
|
|
|
|
|
### Dataset Size |
|
|
The dataset contains **~372β412 samples** per language, depending on the source repository. |
|
|
|
|
|
## π Prompt Example for Test Generation |
|
|
|
|
|
**Suffix syntax for each language:** |
|
|
suffix syntax is to put in the end of the prompt ( after wrap in the chat template if need ) to generate the expected test function and avoid hallucination |
|
|
```plaintext |
|
|
"Rust": "#[test]\nfn test_{function_name}() {" |
|
|
|
|
|
"Julia": "@testset \"{function_name} Tests\" begin" |
|
|
|
|
|
"Go": "func Test{function_name_with_uppercase_first_letter}(" |
|
|
``` |
|
|
This dataset uses a structured prompt format for three programming languages: **Rust**, **Julia**, and **Go**. |
|
|
Each language has two variants: |
|
|
|
|
|
- **`instruct`** β Full instruction prompt including explicit guidance to generate a unit test for a given function. |
|
|
- **`base`** β Minimal version that only contains the function code and a short comment reminding to check correctness. |
|
|
|
|
|
### Structure |
|
|
|
|
|
```python |
|
|
prompts = { |
|
|
"Rust": { |
|
|
"instruct": ( |
|
|
"{function_code}\n" |
|
|
"Generate Rust unittest for {function_name} function in module {file_path}:\n" |
|
|
), |
|
|
"base": ( |
|
|
"{function_code}\n" |
|
|
"// Check the correctness for {function_name} function in Rust\n" |
|
|
), |
|
|
}, |
|
|
"Julia": { |
|
|
"instruct": ( |
|
|
"{function_code}\n" |
|
|
"Generate Julia unittest for {function_name} function in module {file_path}:\n" |
|
|
), |
|
|
"base": ( |
|
|
"{function_code}\n" |
|
|
"# Check the correctness for {function_name} function in Julia\n" |
|
|
), |
|
|
}, |
|
|
"Go": { |
|
|
"instruct": ( |
|
|
"{function_code}\n" |
|
|
"Generate Go unittest for {function_name} function in module {file_path}:\n" |
|
|
), |
|
|
"base": ( |
|
|
"{function_code}\n" |
|
|
"// Check the correctness for {function_name} function in Go\n" |
|
|
), |
|
|
}, |
|
|
} |
|
|
|
|
|
|
|
|
|