Skip to content
This repository has been archived by the owner on Feb 3, 2023. It is now read-only.

WIP: 128 hash table mock #136

Merged
merged 52 commits into from
Jul 19, 2018
Merged

WIP: 128 hash table mock #136

merged 52 commits into from
Jul 19, 2018

Conversation

Copy link
Contributor

@sphinxc0re sphinxc0re left a 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!


impl ChainIterator {

pub fn new<HT: 'static + HashTable> (table: Rc<HashTable>, pair: &Option<Pair>) -> ChainIterator {
Copy link
Contributor

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.

let pair = Pair::new(self, entry);

if !(pair.validate()) {
return Result::Err(HolochainError::new("attempted to push an invalid pair for this chain"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

strip the Result::

let next_pair = pair.header().next();

if top_pair != next_pair {
return Result::Err(HolochainError::new(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

strip the Result::

}
match result {
Result::Ok(_) => Result::Ok(pair),
Result::Err(e) => Result::Err(e),
Copy link
Contributor

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::

/// tests for ht.open()
fn open() {
let mut ht = test_table();
assert_eq!(Result::Ok(()), ht.open());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

strip the Result::

/// tests for ht.close()
fn close() {
let mut ht = test_table();
assert_eq!(Result::Ok(()), ht.close());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

strip the Result::


// sort by attribute value
assert_eq!(Ordering::Less, m_1ax.cmp(&m_1ay));
assert_eq!(Ordering::Greater, m_1ay.cmp(&m_1ax));
Copy link
Contributor

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);

Copy link
Contributor Author

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

@codecov-io
Copy link

Codecov Report

Merging #136 into develop will increase coverage by 1.8%.
The diff coverage is 95.89%.

Impacted file tree graph

@@            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
Impacted Files Coverage Δ
core/src/nucleus/ribosome.rs 89.02% <100%> (ø) ⬆️
core/src/persister.rs 95.23% <100%> (-0.42%) ⬇️
core/src/hash_table/pair.rs 98.14% <100%> (ø)
core/src/hash_table/header.rs 96.89% <100%> (ø)
core/src/hash_table/entry.rs 96.59% <90.9%> (ø)
core/src/hash_table/pair_meta.rs 94.93% <94.93%> (ø)
core/src/agent/keys.rs 71.42% <0%> (+9.52%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 77faa09...ea17a54. Read the comment docs.

Copy link
Member

@zippy zippy left a 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!

@thedavidmeister thedavidmeister merged commit 554f1c9 into develop Jul 19, 2018
@sphinxc0re sphinxc0re deleted the 128-hash-table-mock branch July 20, 2018 10:57
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mock local hash table use a collection that allows more efficient inserting of pairs into source chains
4 participants