Giter Club home page Giter Club logo

words-test's Introduction

README

This repository contains a Thor task which, given a dictionary, generates two output files, 'sequences.txt' and 'words.txt'.

  • sequences.txt contains every sequence of four letters (A-z) that appears in exactly one word of the dictionary, one sequence per line.
  • words.txt contains the corresponding words that contain the sequences, in the same order, again one per line.

Requirements

  • Ruby 2.2.0.

The Set Up

  • Clone this repository:

    git clone [email protected]:sbsurf/words-test.git
    
  • cd into the newly-created words-test directory, and install the gems by running bundle install or simply bundle. You may want to create and use a new gemset before installing the gems.

  • Still in the app directory, you can run

    thor list
    

to see the list of Thor tasks. You should see the hello_labs:parser:parse task. This is the command you will run after completing the initial set up steps.

  • By default, the task will use the input/dictionary.txt file (included). If you'd like to use a different file, download or create it before running the task.

Running the Task

  • The easiest way to run the task is with default options:

    thor hello_labs:parser:parse
    
    • This assumes that:
      • The input file input/dictionary.txt exists and is not empty.
      • There are no output/sequences.txt or output/words.txt files yet.
  • Pass in task parameters in order to specify a different input file, to change the default output directory, or to force the script to overwrite existing output files. To see the expected parameters and their default values, run:

    thor help hello_labs:parser:parse
    
  • For more information on Thor, visit https://github.com/erikhuda/thor/wiki.

Running the Tests

  • To run the test suite, simply use the Rspec command:
    bundle exec rspec
    

or simply:

rspec
  • The tests use mocking where it makes sense, and cover:
    • File creation logic
    • Option switch logic
    • Dictionary parsing algorithm. The file found at spec/input/dictionary.txt, which contains various test cases, is used for this purpose.

words-test's People

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.