Coder Social home page Coder Social logo

carplayground's Introduction

Car Playground

运行环境

>ruby -v
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15]

直接得到示例结果

2.3.1 :001 > car = Carmove.new
2.3.1 :002 > car.run
Test Input:
5 5
1 2 N
LMLMLMLMM
3 3 E
MMRMMRMRRM
Expected Output:
1 3 N
5 1 E

手动调用

2.3.1 :001 > car = Car.new
2.3.1 :002 > car.position= '5 5'
2.3.1 :003 > car.position= "1 2 E"
2.3.1 :004 > car.position= "LMLMDDLMLMM"
2.3.1 :005 > car.position= "3 3 N"
2.3.1 :006 > car.position= "MMRMMRMRSLM"
2.3.1 :007 > car.run
Expected Output:
指令D错误
指令D错误
2 2 E
指令S错误
5 3 S

测试

需要用到gem

sudo gem install test-unit

运行测试代码

ruby testsuite.rb
Loaded suite Unnamed TestSuite
Started
5 5
1 2 N
LMLMLMLMM
3 3 E
MMRMMRMRRM
Expected Output:
1 3 N
5 1 E
Finished in 0.000836 seconds.
----------------------------------------------------------------------------------------------------------------------------------------------------
1 tests, 6 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed
----------------------------------------------------------------------------------------------------------------------------------------------------
1196.17 tests/s, 7177.03 assertions/s

carplayground's People

Contributors

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