-
Notifications
You must be signed in to change notification settings - Fork 267
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, basically strip all the Result::
prefixes and adjust the ChainIterator
. Other than that, good job!
core/src/chain/mod.rs
Outdated
|
||
impl ChainIterator { | ||
|
||
pub fn new<HT: 'static + HashTable> (table: Rc<HashTable>, pair: &Option<Pair>) -> ChainIterator { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the Iterator should do the same thing as the Chain with the HashTable type.
core/src/chain/mod.rs
Outdated
let pair = Pair::new(self, entry); | ||
|
||
if !(pair.validate()) { | ||
return Result::Err(HolochainError::new("attempted to push an invalid pair for this chain")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
strip the Result::
core/src/chain/mod.rs
Outdated
let next_pair = pair.header().next(); | ||
|
||
if top_pair != next_pair { | ||
return Result::Err(HolochainError::new( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
strip the Result::
core/src/chain/mod.rs
Outdated
} | ||
match result { | ||
Result::Ok(_) => Result::Ok(pair), | ||
Result::Err(e) => Result::Err(e), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here: strip the Result::
core/src/hash_table/memory/mod.rs
Outdated
/// tests for ht.open() | ||
fn open() { | ||
let mut ht = test_table(); | ||
assert_eq!(Result::Ok(()), ht.open()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
strip the Result::
core/src/hash_table/memory/mod.rs
Outdated
/// tests for ht.close() | ||
fn close() { | ||
let mut ht = test_table(); | ||
assert_eq!(Result::Ok(()), ht.close()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
strip the Result::
core/src/hash_table/pair_meta.rs
Outdated
|
||
// sort by attribute value | ||
assert_eq!(Ordering::Less, m_1ax.cmp(&m_1ay)); | ||
assert_eq!(Ordering::Greater, m_1ay.cmp(&m_1ax)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be better to assert for the actual condition? So e.g.
assert!(m_1ax < m_2ax);
assert_eq!(m_1ax, m_1ax);
assert!(m_2ax > m_1ax);
assert!(m_1ay < m_2ax);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well asserting equality is testing a different thing, as for the others i'm not sure
it makes sense to me that i'm testing cmp
but i could add the operators as well to cover both
…-table-mock # Conflicts: # core/src/agent/mod.rs # core/src/nucleus/ribosome.rs
Codecov Report
@@ Coverage Diff @@
## develop #136 +/- ##
==========================================
+ Coverage 84.09% 85.89% +1.8%
==========================================
Files 15 16 +1
Lines 660 773 +113
==========================================
+ Hits 555 664 +109
- Misses 105 109 +4
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks go to me!
fixes #128
fixes #35
followup: