Files
cobol-java-v3/sample/README.md
T
hangshuo652 5342220de5 docs: restore detailed design documents
Restored the following documents that were removed in Black-white-box-Merge:
- docs/detailed-design/ (9 detailed design documents + append_doc.py)
- docs/development-paradigm.md (development paradigm flowchart)
- docs/test-report.md (test report)
- AGENTS.md (project instructions)
- _AI_USAGE_LOG.md (AI usage log)
- CLAUDE.md (project instructions)
- sample/ (4 example files)
2026-08-23 17:22:13 +08:00

85 lines
1.9 KiB
Markdown

# 示例数据
本目录包含 COBOL 迁移验证平台 V3 的示例数据。
## 文件说明
| 文件 | 说明 |
|------|------|
| `SIMPLE.cbl` | 最简 COBOL 程序示例 |
| `SIMPLE.cpy` | COPYBOOK 示例 |
| `SIMPLE-output.json` | 预期输出格式示例 |
## SIMPLE.cbl 说明
这是一个最简的 COBOL 程序,演示基本的 MOVE 和 DISPLAY 语句。
### 程序结构
```
IDENTIFICATION DIVISION. → 程序标识
DATA DIVISION. → 数据定义
WORKING-STORAGE SECTION. → 工作存储区
PROCEDURE DIVISION. → 过程部
```
### 数据定义
```cobol
01 BILL-RECORD.
05 BR-AMT PIC S9(7)V99 COMP-3. 金额 (压缩十进制)
05 BR-STATUS PIC X. 状态 (字符)
05 BR-DATE PIC 9(8). 日期 (数字)
```
### 过程逻辑
```cobol
MOVE 1500 TO BR-AMT. 赋值金额
MOVE 'A' TO BR-STATUS. → 赋值状态
MOVE 20260522 TO BR-DATE. 赋值日期
DISPLAY BR-AMT. 显示金额
DISPLAY BR-STATUS. 显示状态
DISPLAY BR-DATE. 显示日期
STOP RUN. 程序结束
```
## 输出格式
`SIMPLE-output.json` 展示了测试数据的标准 JSON 格式:
```json
{
"program": "程序名",
"version": "3.0",
"test_data": [
{
"id": 1,
"description": "测试描述",
"input": { "输入字段": "值" },
"expected_output": { "DISPLAY": ["输出值"] },
"working_storage": { "工作存储字段": "值" }
}
],
"coverage": {
"branch_coverage": "覆盖率",
"total_branches": 总分支数,
"covered_branches": 已覆盖分支数
}
}
```
## 使用方法
```bash
# 使用示例 COBOL 程序运行测试
python -m cobol_testgen sample/SIMPLE.cbl sample/output/
# 查看生成的 JSON
cat sample/output/SIMPLE.json
```
## 扩展示例
更多示例请参考 `benchmark-programs/` 目录,包含 43 个真实 COBOL 程序。