Coder Social home page Coder Social logo

next-date-testing's Introduction

MSSV: 20021463

Họ và tên: Đỗ Duy Tuấn

Đặc tả

Source kiểm thử chương trình tính toán ngày tiếp theo với input đầu vào là ngày, tháng và năm. Chương trình sẽ tính toán ngày tiếp theo trong phạm vi từ năm 1900 đến năm 2025.

Hàm tính toán sẽ tính toán xem đầu vào có chứa năm thoả mãn từ 1900-2025 hay không, tiếp thục kiểm tra tháng có hợp lệ từ 1-12 không và cuối cùng kiểm tra ngày có hợp lệ với tháng.

Các điểm cần lưu ý ở bài toán là ngoại lệ của tháng 2, khi năm nhuận nó có 29 ngày và bình thường thì là 28. Ngoài ra ta sẽ kiểm tra năm có chia hết cho 4 hay không (nghĩa là nó có thể là năm nhuận), rồi chúng ta phải xem liệu nó chia hết cho 100 hay không, nếu có thì nó có chia hết cho 400 không? Nếu đúng thì nó sẽ là năm nhuận.

Cuối cùng chúng ta cũng phải kiểm tra tính hợp lệ của đầu vào, các giá trị âm dương, quá giới hạn,...

SOURCE CODE

Source code có sử dụng thư viện Jest phục vụ việc tạo, chạy và cấu trúc test được tạo ra bởi Facebook.

Để chạy source:

    $ npm install
    $ npm test

Toàn bộ test case năm trong file JSON datatest.json.

next-date-testing's People

Watchers

Mason Do avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.