Coder Social home page Coder Social logo

danilaprokoshev / battle_asserts Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hexlet-codebattle/battle_asserts

0.0 1.0 0.0 1.62 MB

Issues (problems) for Codebattle games

Home Page: https://codebattle.hexlet.io/

License: Eclipse Public License 1.0

Clojure 99.75% Makefile 0.22% Dockerfile 0.02% Shell 0.01%

battle_asserts's Introduction

Build Status Hexlet chat

Setup for development

Contributing

  1. Fork it
  2. Clone repo (https://github.com/{your-nickname}/battle_asserts.git)
  3. Create your feature branch (git checkout -b my-new-feature)
  4. Make changes
  5. Run tests (make test).
  6. Commit your changes (git commit -am 'Added some feature')
  7. Push to the branch (git push origin my-new-feature)
  8. Create new Pull Request
  9. Check if Request passed GithubActions

How to add a new issue

1. Write the description of the issue with function signature and test-data

A description of the issue includes:

  • level — difficulty of the problem; possible values are elementary, easy, medium, hard.

  • description — detailed description of the issue. Now supported laguages is ru and en, en is required. You can run make check-translations for list current translation progress.

  • tags — tags that provides addittional info about task.

  • signature — function signature; map with input and output types. Available types integer, float, string, array, hash (map, dicts). See examples in the existing issues.

  • test-data — data in a specified format which will be used to test solutions. The first element in this list will be displayed as an example to players, so it should clarify and illustrate the problem as much as possible. Do not choose a trivial case for this example.

Example:

(ns battle-asserts.issues.array_sum)

(def level :elementary)

(def tags ["training" "collections"])

(def description 
  {:en "Calculate the sum of array."
   :ru "Рассчитайте сумму всех чисел в массиве."})

(def signature
  {:input  [{:argument-name "numbers" :type {:name "arr" :nested {:name "integer"}}}]
   :output {:type {:name "integer"}}})

(def test-data
  [{:expected 1
    :arguments [[1]]}
  {:expected 0
    :arguments [[]]}
   {:expected 10
    :arguments [[1 2 3 4]]}])

See examples in src/battle_asserts/issues/*.clj

2. Create pull-request

It will appear on codebattle after merge

3. Write the implementation of the issue and test

An implementation of the issue includes:

  • arguments-generator — arguments generator for the solution function; generated arguments will be used to test players' solutions.
  • solution — implemented correct solution.

Example:

(ns battle-asserts.issues.array_sum)

(def level :elementary)

(def tags ["training" "collections"])

(def description 
  {:en "Calculate the sum of array."
   :ru "Рассчитайте сумму всех чисел в массиве."})

(def signature
  {:input  [{:argument-name "numbers" :type {:name "arr" :nested {:name "integer"}}}]
   :output {:type {:name "integer"}}})

(def test-data
  [{:expected 1
    :arguments [[1]]}
  {:expected 0
    :arguments [[]]}
   {:expected 10
    :arguments [[1 2 3 4]]}])

(defn arguments-generator
  []
  (gen/tuple (gen/list gen/small-integer))

(defn solution
  [numbers]
  (apply + numbers))

Corresponding tests are in test/test_helper.clj there is no need to add tests to this file, because tests runs dynamically, depending on the described signature, test-data, arguments-generator and solution.

  • run-solution-spec-test tests are checking that result type of solving issue is correct.
  • run-generator-spec-test tests are checking that input signatures are correctly described for arguments-generator.
  • run-solution-test tests are checking that test data solves correctly.
  • run-test-data-spec-test tests are checking that test data corresponds to signature.

4. Create pull-request

It will appear with auto-generated asserts on codebattle after merge

Useful commands

  • make check-translations check current tasks translation progress.
  • make check-tags check current tasks tagging progress.
  • make check-generators-and-solutions check current tasks solution and arguments-generator progress.
  • make collect-tags check tags stats, useful to check typo in tags.

Related links

Leiningen

battle_asserts's People

Contributors

aamanunin avatar aelaa avatar begor avatar burenkov-anton avatar dfdfdf123 avatar dosbol avatar dstarcev avatar fey avatar ilya-manin avatar imamatory avatar ivanlemeshev avatar krotos avatar makapoxa avatar maratori avatar mikhkonkov avatar mokevnin avatar mrphantomt avatar olegsilakov avatar orion122 avatar plugin73 avatar redbrother avatar seth2810 avatar solar05 avatar sun1one avatar uunnamed avatar v-kolesnikov avatar vtm9 avatar vyorkin avatar yigres avatar zzet avatar

Watchers

 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.