#!/usr/bin/ruby

$:.unshift File.join(File.dirname(__FILE__), '..')

load 'daniel'

describe Daniel::PasswordGenerator do
  [
    ["foo", "baz", "Dp4iWIX26UwV55N(", "8244c50a1000baz"],
  ].each do |items|
    master, code, result, reminder = items
    it "gives the expected password for #{master}, #{code}" do
      gen = Daniel::PasswordGenerator.new master
      gen.generate(code, Daniel::Parameters.new).should == result
    end
    it "gives the expected reminder for #{master}, #{code}" do
      gen = Daniel::PasswordGenerator.new master
      gen.reminder(code, Daniel::Parameters.new).should == reminder
    end
    it "gives the expected password for #{master}, #{code} reminder" do
      gen = Daniel::PasswordGenerator.new master
      gen.generate_from_reminder(reminder).should == result
    end
  end
end

#!/usr/bin/ruby

$:.unshift File.join(File.dirname(__FILE__), '..')

load 'daniel'

describe Daniel::PasswordGenerator do
  [
    ["foo", "bar", "3*Re7n*qcDDl9N6y", "8244c50a1000bar"],
    ["foo", "baz", "Dp4iWIX26UwV55N(", "8244c50a1000baz"],
  ].each do |items|
    master, code, result, reminder = items
    it "gives the expected password for #{master}, #{code}" do
      gen = Daniel::PasswordGenerator.new master
      gen.generate(code, Daniel::Parameters.new).should == result
    end
    it "gives the expected reminder for #{master}, #{code}" do
      gen = Daniel::PasswordGenerator.new master
      gen.reminder(code, Daniel::Parameters.new).should == reminder
    end
    it "gives the expected password for #{master}, #{code} reminder" do
      gen = Daniel::PasswordGenerator.new master
      gen.generate_from_reminder(reminder).should == result
    end
  end
end

Add a test for the 9 problem.
Add a test for the 9 problem.

The original C implementation contained a bug misclassifying the number 9 as
being in the SYMBOLS_OTHER group, not the NUMBERS group.  Add a test to
check for this.

Signed-off-by: brian m. carlson <738bdd359be778fee9f0fc4e2934ad72f436ceda@crustytoothpaste.net>
