This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// TotalCalculator.js | |
function TotalCalculator() { | |
} | |
TotalCalculator.prototype.calculate = function(quantity, price) { | |
var _quantity = parseInt(quantity); | |
if (isNaN(_quantity)) | |
return 'N/A'; | |
var _price = parseInt(price.replace('$', '')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using Machine.Specifications; | |
using Given = Machine.Specifications.Establish; | |
using When = Machine.Specifications.Because; | |
using Then = Machine.Specifications.It; | |
namespace TryMSpec { | |
public class TicketCalculator{ | |
private decimal _ticket_price = 11m; | |
public void StartPurchase(int runtime, DayOfWeek day, bool isParquet, bool is3D) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns roman-numerals.core-test | |
(:require [clojure.test :refer :all])) | |
(def mapping { | |
0 "" | |
1 "I" | |
4 "IV" | |
5 "V" | |
9 "IX" | |
10 "X" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Solving the String Calculator Kata | |
# http://osherove.com/tdd-kata-1/ | |
class StringCalculator | |
def self.add(numbers) | |
return 0 if numbers.empty? | |
numbers.split(",").map(&:to_i).reduce(:+) | |
#splitted_array = numbers.split(",") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Location | |
attr_reader :city, :user | |
def initialize(city, user) | |
@city = city | |
@user = user | |
end | |
end | |
class User | |
attr_reader :name |
NewerOlder