|
--- |
|
dataset_info: |
|
features: |
|
- name: ID |
|
dtype: int64 |
|
- name: Language |
|
dtype: string |
|
- name: Repository Name |
|
dtype: string |
|
- name: File Name |
|
dtype: string |
|
- name: File Path in Repository |
|
dtype: string |
|
- name: File Path for Unit Test |
|
dtype: string |
|
- name: Code |
|
dtype: string |
|
- name: Unit Test - (Ground Truth) |
|
dtype: string |
|
splits: |
|
- name: train |
|
num_bytes: 52934692 |
|
num_examples: 2653 |
|
download_size: 13965160 |
|
dataset_size: 52934692 |
|
configs: |
|
- config_name: default |
|
data_files: |
|
- split: train |
|
path: data/train-* |
|
--- |
|
--- |
|
# Dataset Card for Open Source Code and Unit Tests |
|
|
|
## Dataset Details |
|
|
|
### Dataset Description |
|
|
|
This dataset contains c++ code snippets and their corresponding ground truth unit tests collected from various open-source GitHub repositories. The primary purpose of this dataset is to aid in the development and evaluation of automated testing tools, code quality analysis, and LLM models for test generation. |
|
|
|
- **Curated by:** Vaishnavi Bhargava |
|
- **Language(s):** C++ |
|
|
|
|
|
<img src="https://cdn-uploads.huggingface.co/production/uploads/6658bb3acf5fc31e3a0bd24a/hyIhFHmrjUzypFgNPU2UX.png" alt="image/png" width="800" height="600"/> |
|
|
|
## Dataset Structure |
|
|
|
```python |
|
from datasets import Dataset, load_dataset |
|
|
|
# Load the dataset |
|
dataset = load_dataset("Nutanix/cpp_unit_tests_benchmark_dataset") |
|
|
|
# View dataset structure |
|
|
|
DatasetDict({ |
|
train: Dataset({ |
|
features: ['ID', 'Language', 'Repository Name', 'File Name', 'File Path in Repository', 'File Path for Unit Test', 'Code', 'Unit Test - (Ground Truth)'], |
|
num_rows: 2653 |
|
}) |
|
}) |
|
``` |
|
|
|
The dataset consists of the following columns: |
|
- `ID`: A unique identifier for each entry in the dataset. [Example: "0"] |
|
- `Language`: The programming language of the file. [Example: "cpp"] |
|
- `Repository Name`: The name of the GitHub repository, formatted as organisation/repository. [Example: "google/googletest"] |
|
- `File Name`: The base name of the file (without extension) where the code or test is located. [Example: "sample1"] |
|
- `File Path in Repository`: The relative path to the file within the GitHub repository. [Example: "googletest/samples/sample1.cc"] |
|
- `File Path for Unit Test`: The relative path to the unit test file, if applicable. [Example: "googletest/samples/sample1_unittest.cc"] |
|
- `Code`: The code content of the file, excluding any documentation or comments. |
|
- `Unit Test - (Ground Truth)`: The content of the unit test file that tests the code. |
|
|
|
|
|
### Dataset Sources |
|
|
|
<img src="https://cdn-uploads.huggingface.co/production/uploads/6658bb3acf5fc31e3a0bd24a/jE8b8wf1uV_boMaHxsmnP.png" width="800" height="600" /> |
|
|
|
- **Repository:** The dataset is sourced from the following GitHub repositories: [Latest Commit before 2 July 24] |
|
- [Pytorch](https://github.com/pytorch/pytorch) |
|
- [Abseil Absl](https://github.com/abseil/abseil-cpp) |
|
- [Google Test](https://github.com/google/googletest) |
|
- [Libphonenumber](https://github.com/google/libphonenumber) |
|
- [Tensorstore](https://github.com/google/tensorstore) |
|
- [TensorFlow](https://github.com/tensorflow/tensorflow) |
|
- [Glog](https://github.com/google/glog/tree/master/src/glog) |
|
- [Cel-cpp](https://github.com/google/cel-cpp/tree/master) |
|
- [LevelDB](https://github.com/google/leveldb) |
|
- [Libaddressinput](https://github.com/google/libaddressinput/tree/master) |
|
- [Langsvr](https://github.com/google/langsvr/tree/main) |
|
- [tsl](https://github.com/google/tsl.git) |
|
- [cel-cpp](https://github.com/google/cel-cpp.git) |
|
- [quiche](https://github.com/google/quiche.git) |
|
|
|
### Some analysis of the dataset: |
|
|
|
|
|
The box plot representation depicting number of Code and Unit Test lines across different repositories |
|
<img src="https://cdn-uploads.huggingface.co/production/uploads/6658bb3acf5fc31e3a0bd24a/E7aoKCvyRBjBR89sbetrR.png" width="800" height="600" /> |
|
|
|
<!-- The histogram visualizes the distribution of the number of lines in the "Code" and "Unit Test-(Ground Truth)" column of the dataset. |
|
|
|
<div style="display: flex;"> |
|
<img src="https://cdn-uploads.huggingface.co/production/uploads/6658bb3acf5fc31e3a0bd24a/pm9VHIoIJgSBTWcmfXPOO.png" width="300" height="300" style="margin-right: 10px;" /> |
|
<img src="https://cdn-uploads.huggingface.co/production/uploads/6658bb3acf5fc31e3a0bd24a/Fo48OZiHeiVLQZ9yA5qch.png" width="300" height="300" /> |
|
</div> |
|
|
|
The histogram visualizes the distribution of the number of tokens in the "Code" and "Unit Test-(Ground Truth)" column of the dataset. |
|
|
|
<div style="display: flex;"> |
|
<img src="https://cdn-uploads.huggingface.co/production/uploads/6658bb3acf5fc31e3a0bd24a/UWb5i1bh5keq8hd7NdT6E.png" width="300" height="300" style="margin-right: 10px;" /> |
|
<img src="https://cdn-uploads.huggingface.co/production/uploads/6658bb3acf5fc31e3a0bd24a/bAgGzQGmrVrMxm-uHxffv.png" width="300" height="300" /> |
|
</div> |
|
--> |
|
|
|
## Uses |
|
|
|
### Direct Use |
|
|
|
This dataset is suitable for : |
|
- Developing and evaluating automated testing tools. |
|
- Analyzing code quality by comparing code with its corresponding unit tests. |
|
- Training and testing LLM models for automated unit test generation. |
|
|
|
|
|
## Dataset Creation |
|
|
|
### Curation Rationale |
|
|
|
The motivation for creating this dataset is to provide a comprehensive collection of code and unit tests from various reputable open-source projects. This can facilitate research and development in the areas of automated testing, code quality analysis, and LLM for software engineering. |
|
|
|
### Source Data |
|
|
|
#### Data Collection and Processing |
|
|
|
The data was collected from public GitHub repositories. The selection criteria included repositories with well-documented code and corresponding unit tests. The data was filtered and normalized to ensure consistency. |
|
|
|
#### Who are the source data producers? |
|
|
|
The source data producers are the contributors to the respective open-source GitHub repositories. |
|
|
|
## Bias, Risks, and Limitations |
|
|
|
The dataset may have biases based on the coding practices and testing methodologies of the included repositories. It may not cover all possible scenarios and edge cases in software testing. |
|
|
|
## Citation [optional] |
|
|
|
|
|
|