Add Unit Test Coverage

Đang mở
#11 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
48/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
python

Hướng nghiên cứu

Start by locating the planet generation, configuration, biome, noise, and PLY export entry points, then identify the existing test framework and run command. Add deterministic tests using small resolutions for the suggested behaviors, including mesh counts, biome classification, and export headers. Done when the documented single command runs a stable suite covering the core paths.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

help wanted

Add Unit Test Coverage

Summary

Add a proper unit test suite for the planet generator, noise deformation, and export pipeline. The project currently has a lot of core logic that should be covered by repeatable tests so regressions are easier to catch.

Why This Matters

  • Planet generation logic is complex and easy to break unintentionally.
  • Biome classification, presets, and terrain shaping have a lot of moving parts.
  • Tests will make it safer to change visuals, tuning, and output formats.
  • A basic test suite will help validate future refactors, including performance work and multithreading.

Suggested Test Areas

1. Configuration and Presets
  • Verify each preset loads expected baseline values.
  • Verify config overrides are applied correctly.
  • Verify invalid values fall back to sane defaults.
2. Sphere Generation
  • Verify the mesh generator returns the expected vertex and face counts for a known resolution.
  • Verify the sphere is closed correctly at the longitude seam.
  • Verify no invalid face indices are produced.
3. Noise Deformation
  • Verify apply_noise(...) is deterministic for the same seed and config.
  • Verify different seeds produce different output.
  • Verify increasing amplitude changes elevation variance.
  • Verify pattern_scale affects terrain variation scale as expected.
  • Verify biome biases influence biome distribution in the expected direction.
  • Verify plains_bias increases flatter terrain regions.
4. Biome Classification
  • Verify high-temperature, high-moisture configs favor rainforest or forest.
  • Verify dry configs favor desert or savanna.
  • Verify cold configs favor tundra or snow.
  • Verify ocean bias shifts classification toward ocean.
  • Verify rock bias shifts classification toward rocky/highland biomes.
5. Planet Generation Entry Point
  • Verify generate_planet(...) returns the expected keys: vertices, faces, colors, metadata, stats.
  • Verify stats counts match the generated geometry.
  • Verify a small known resolution produces a valid mesh and non-empty biome stats.
6. Export
  • Verify PLY export writes a file.
  • Verify the exported file contains the expected header fields.
  • Verify vertex and face counts in the output match the generated mesh.

Sample Test Criteria

  • Tests must be deterministic and not depend on random global state.
  • Tests should use small resolutions so they run quickly.
  • Tests should cover both normal cases and edge cases.
  • Tests should fail when a regression changes mesh structure, biome assignment, or config handling.
  • Tests should not rely on visual inspection.
  • Performance-sensitive tests should stay lightweight enough for regular local runs and CI.

Acceptance Criteria

  • A test framework is added and documented.
  • Core generation paths have meaningful unit coverage.
  • Tests run locally with a single command.
  • The suite catches obvious regressions in presets, terrain deformation, biome logic, and export output.
  • At least a few tests are deterministic and stable enough for CI.

Optional Follow-Up

  • Add snapshot-style checks for generated stats.
  • Add integration tests for the web API endpoints.
  • Add a smoke test that generates and exports a planet from a known config.
Ngôn ngữ chính
Python
Star
0
Fork
0
Merge trung bình
11 phút
Pull request đã merge (30 ngày)
1

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của TiElixir/Pylanet

Tất cả issue của TiElixir/Pylanet

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.