Make use of practice exercise scenarios
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
- 35/100
Hướng nghiên cứu
Bắt đầu bằng cách xem xét các mục kịch bản được liệt kê trong canonical-data.json và các trình tạo kiểm thử bài tập PHP hoặc student stubs sử dụng chúng. Xác định những kịch bản nào không bao giờ, luôn luôn hoặc tùy chọn được triển khai, sau đó xác minh rằng các kịch bản tùy chọn có thể được điều khiển bằng các hằng số được đề xuất và rằng các kiểm thử bắt buộc vẫn chạy như dự định.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Problem
Some practice exercises have scenarios "to allow for selectively including/excluding test cases based on a property of the test case". We currently have not defined how these are treated within the PHP track.
At the time of writing, these are the scenarios in use within exercises:
~/.cache/exercism/configlet/problem-specifications$ fgrep -H -e 'scenario' -r --include='*.json' exercises/
exercises/bank-account/canonical-data.json: "scenarios": ["concurrent"],
exercises/dnd-character/canonical-data.json: "scenarios": ["random"],
exercises/high-scores/canonical-data.json: "scenarios": ["immutable"],
exercises/protein-translation/canonical-data.json: "scenarios": ["input-validation", "runtime-validation"],
exercises/parallel-letter-frequency/canonical-data.json: "scenarios": ["unicode"],
exercises/parallel-letter-frequency/canonical-data.json: "scenarios": ["concurrent"],
exercises/reverse-string/canonical-data.json: "scenarios": ["unicode"],
exercises/gigasecond/canonical-data.json: "scenarios": ["date"],
exercises/gigasecond/canonical-data.json: "scenarios": ["datetime"],
exercises/gigasecond/canonical-data.json: "scenarios": ["immutable"],
exercises/diffie-hellman/canonical-data.json: "scenarios": ["random"],
exercises/diffie-hellman/canonical-data.json: "scenarios": ["immutable"],
exercises/forth/canonical-data.json: "scenarios": ["local-scope"],
exercises/armstrong-numbers/canonical-data.json: "scenarios": ["big-integer"],
exercises/simple-cipher/canonical-data.json: "scenarios": ["random"],
exercises/triangle/canonical-data.json: "scenarios": ["floating-point"],
exercises/anagram/canonical-data.json: "scenarios": ["unicode"],
Suggestion
Scenarios can be grouped into categories based on how we want to treat them:
- Never implemented: We do not implement those test cases at all.
- Always implemented: We always include those test cases as required tests.
- Optionally implemented: Students should be able to opt-in to implement their solution so they pass those test cases in addition to the required tests.
We decide, which scenarios we want to treat as "optional", "always" or "never". I think, this a way to use the categories:
- Never implemented:
concurrent,library-test, any unknown scenario - Always implemented:
date,datetime,floating-point,local-scope - Optionally implemented:
big-integer,immutable,input-validation,random,runtime-validation,unicode
Based on these categories, test generators can simply skip over "never" scenarios and treat "always" scenarios like "no scenario".
For the "optional" ones I suggest using PHP constants in students files (define('BIG_INTEGER', 1);) and inside the test methods if (!defined('BIG_INTEGER') || constant('BIG_INTEGER' !== 1)) { $this->markTestSkipped(); }. Using the functions to create / read the constants avoids the problems that arise, when including the students file into a class method (as we do in the test class).
The constants provide a means to easily pre-define them in the students stub file:
[...]
// Change this constant value to 1 if you want to test your solution using Unicode strings:
define('UNICODE', 0);
class ExerciseName
{
[...]
}
- Ngôn ngữ chính
- PHP
- Star
- 167
- Fork
- 150
- Merge trung bình
- 1 ngày 18 giờ
- Pull request đã merge (30 ngày)
- 7
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của exercism/php
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
-
Re-design `allergies`Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
-
Discussion: Test generator designCó thể làm lại được @mk-mxp đã nhận 372 ngày trước và không có pull request nào đang mở. Đang mở
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
-
Tracking: Test generator MVPCó thể làm lại được @mk-mxp đã nhận 962 ngày trước và không có pull request nào đang mở. Đang mở
exercism/php#631 · 2 bình luận · 1 reaction · 1 người được giao ·
Issue tương tự
-
cloning objets from planningĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
glpi-project/glpi#25922 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Translation TwigBridge
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
symfony/symfony-docs#23308 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
sync-en
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày
-
sync-en
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 4 ngày
-
Перевод устарел
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100