16 failures

This commit is contained in:
Netscape Navigator 2020-05-11 07:02:40 -05:00
parent 18a5831514
commit aab41d6fba
3 changed files with 14 additions and 13 deletions

View File

@ -51,7 +51,7 @@ See `kitchen_sink.sh` examples.
- [X] Update Ruby API docs
- [X] Update blobs spec to clear out blob folder every time it runs.
- [ ] Oops, `lipmaa` field needs to be a hash, not an integer!
- [ ] Change draft and message templates to render headers in this order: `author`, `prev`, `lipmaa`, `kind`, `depth`.
- [ ] Change draft and message templates to render headers in this order: `author`, `prev`, `lipmaa`, `depth`, `kind`.
- [ ] Make location of blob folder configurable?
- [ ] Update Dev docs in protocol spec to reflect changes to `lipmaa` header.
- [ ] Update spec document CLI usage examples to reflect API changes in 2020.

View File

@ -89,7 +89,9 @@ module Pigeon
# The original lipmaa function returns -1 for 0
# but that does not mesh well with our serialization
# scheme. Comments welcome on this one.
return 0 if n < 1 # Prevent -1, division by zero etc..
if n < 1 # Prevent -1, division by zero etc..
return nil
end
m, po3, x = 1, 3, n
# find k such that (3^k - 1)/2 >= n

View File

@ -1,20 +1,19 @@
RSpec.describe Pigeon::Helpers do
it "creates lipmalinks" do
[
[-1, 0],
[0, 0],
[1, 0],
[2, 1],
[3, 2],
[-1, nil],
[0, nil],
[1, nil],
[2, nil],
[3, nil],
[4, 1],
[5, 4],
[6, 5],
[7, 6],
[5, nil],
[6, nil],
[7, nil],
[8, 4],
[13, 4],
].map do |(input, expected)|
actual = Pigeon::Helpers.lipmaa(input)
expect(actual).to eq(expected)
].each do |(input, expected)|
expect(Pigeon::Helpers.lipmaa(input)).to eq(expected)
end
end