The testing process: Implementing code or fixing bugs in Ruby.
Motivation: Basic familiarity with the programming language used on the job is a prerequisite for quickly getting up to speed.
The testing process: Using data structures to optimize code performance.
Motivation: Choosing the right data structure to solve the problem at hand is a very important skill for a good programmer.
The testing process: Processing or building strings.
Motivation: String is one of the most commonly used data structures, so every programmer should be skilled at string manipulation.
Write a function that provides change directory (cd) function for an abstract file system.
- Root path is '/'.
- Path separator is '/'.
- Parent directory is addressable as '..'.
- Directory names consist only of English alphabet letters (A-Z and a-z).
path = Path.new('/a/b/c/d') puts path.cd('../x').current_path
should display '/a/b/c/x'.
Note: Do not use built-in path-related functions.
- Example case: NoMethodError: pathtest.rb:10:in `test1'
- Two times down: NoMethodError: pathtest.rb:21:in `test2'
- Two times up: NoMethodError: pathtest.rb:37:in `test3'
- Complex paths: NoMethodError: pathtest.rb:57:in `test4'