Git Product home page Git Product logo

your-mechanic-st_test's Introduction

Overview

The Mechanic Scheduler manages a list representing disjointed intervals of integers.

Example

$ ruby run.rb 
Hi, What is your name? 
John

Hi, John!
I can manage intervals for integer numbers. I can add or remove intervals through methods.

What command do you want? e.g: add(1,5) or remove(2,3) (call 'exit' to exit).
add(1,5)
Interval [1, 5] added successfully!
>> [[1, 5]]
What command do you want? e.g: add(1,5) or remove(2,3) (call 'exit' to exit).
remove(2,3)
Interval [2, 3] removed successfully!
>> [[1, 2], [3, 5]]
What command do you want? e.g: add(1,5) or remove(2,3) (call 'exit' to exit).
add(6,8)
Interval [6, 8] added successfully!
>> [[1, 2], [3, 5], [6, 8]]
What command do you want? e.g: add(1,5) or remove(2,3) (call 'exit' to exit).
remove(4,7)
Interval [4, 7] removed successfully!
>> [[1, 2], [3, 4], [7, 8]]
What command do you want? e.g: add(1,5) or remove(2,3) (call 'exit' to exit).
add(2,7)
Interval [2, 7] added successfully!
>> [[1, 8]]
What command do you want? e.g: add(1,5) or remove(2,3) (call 'exit' to exit).
exit
Okay, cya!

How to run

Execute the file run.rb using the ruby executable:

$ ruby run.rb

To run the automated tests, run the file run_tests.rb using the ruby executable:

$ ruby run_tests.rb 
...
examples: 3, failed: 0

Documentation

Mechanic Scheduler

This class manages a list of intervals, with methods for adding, removing and printing the list

@scheduler = MechanicScheduler.new

@scheduler.add(1, 5)
@scheduler.remove(2, 3)
@scheduler.print

Mechanic Interface

This class can be used as an interface to receive user's input

@interface = MechanicInterface.instance

@interface.start

Mechanic Tester

This class can be used to run automated tests

@tester = MechanicTester.new

@teser.run([
  {
    steps: [ 'add(1,5)', 'add(8,9)' ],
    expected: [[1, 5], [8, 9]]
  }
])

your-mechanic-st_test's People

Contributors

emiliano1 avatar

Stargazers

 avatar

Watchers

 avatar  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.