Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

62 #84

Closed
wants to merge 16 commits into from
Closed

62 #84

wants to merge 16 commits into from

Conversation

l3r8yJ
Copy link
Contributor

@l3r8yJ l3r8yJ commented Feb 16, 2023

@yegor256 take a look, please
closes #62
Here fix for:

  • It's only possible to call put() once, the second call leads to Err

could you write a clarification for:

  • Until put() is called for a vertex, all data() calls return Err
  • Calling put(Hex::empty()) makes the vertex "full"(see Sodg::full() #61)

src/ops.rs Outdated Show resolved Hide resolved
src/ops.rs Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Feb 16, 2023

Codecov Report

Merging #84 (c1381bc) into master (1fba9b8) will increase coverage by 2.07%.
The diff coverage is 93.75%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##           master      #84      +/-   ##
==========================================
+ Coverage   64.77%   66.85%   +2.07%     
==========================================
  Files          19       20       +1     
  Lines        1831     1973     +142     
==========================================
+ Hits         1186     1319     +133     
- Misses        645      654       +9     
Impacted Files Coverage Δ
src/vertex.rs 100.00% <ø> (ø)
src/ops.rs 94.56% <93.75%> (-0.16%) ⬇️
src/merge.rs 92.85% <0.00%> (-7.15%) ⬇️
src/clone.rs 92.30% <0.00%> (ø)
src/lib.rs 38.05% <0.00%> (+0.38%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@l3r8yJ
Copy link
Contributor Author

l3r8yJ commented Feb 16, 2023

@yegor256 take a look, please

also, i think i just figured out the other two items, i'll send a solution soon

@l3r8yJ l3r8yJ requested a review from yegor256 February 16, 2023 23:00
@l3r8yJ
Copy link
Contributor Author

l3r8yJ commented Feb 16, 2023

i think it's close to a solution(or not ;0)

@yegor256
Copy link
Member

@rultor merge

@rultor
Copy link
Contributor

rultor commented Feb 17, 2023

@rultor merge

@yegor256 OK, I'll try to merge now. You can check the progress of the merge here

@rultor
Copy link
Contributor

rultor commented Feb 17, 2023

@rultor merge

@l3r8yJ @yegor256 Oops, I failed. You can see the full log here (spent 3min)

test merge::merges_simple_loop ... \u001b[32mok\u001b(B\u001b[m
test find::relay_modifies_sodg_back ... \u001b[32mok\u001b(B\u001b[m
test merge::merges_two_graphs ... \u001b[32mok\u001b(B\u001b[m
test ops::adds_twice ... \u001b[32mok\u001b(B\u001b[m
test merge::merges_connected_singletons ... \u001b[32mok\u001b(B\u001b[m
test ops::binds_simple_vertices ... \u001b[32mok\u001b(B\u001b[m
test ops::binds_two_names ... \u001b[32mok\u001b(B\u001b[m
test ops::binds_to_root ... \u001b[32mok\u001b(B\u001b[m
test ops::checks_for_data_absence ... \u001b[32mok\u001b(B\u001b[m
test ops::check_for_data_receiving_before_put ... \u001b[32mok\u001b(B\u001b[m
test ops::builds_list_of_kids ... \u001b[32mok\u001b(B\u001b[m
test ops::checks_for_put_called_once ... \u001b[32mok\u001b(B\u001b[m
test ops::checks_for_put_make_vert_full ... \u001b[32mok\u001b(B\u001b[m
test ops::finds_kid_and_loc_by_prefix ... \u001b[32mok\u001b(B\u001b[m
test ops::finds_kid_by_prefix ... \u001b[32mok\u001b(B\u001b[m
test ops::gets_kid_from_absent_vertex ... \u001b[32mok\u001b(B\u001b[m
test ops::gets_absent_kid ... \u001b[32mok\u001b(B\u001b[m
test ops::finds_all_kids ... \u001b[32mok\u001b(B\u001b[m
test ops::gets_data_from_empty_vertex ... \u001b[32mok\u001b(B\u001b[m
test ops::overwrites_edge ... \u001b[32mok\u001b(B\u001b[m
test ops::overwrites_edges::case_1 ... \u001b[32mok\u001b(B\u001b[m
test ops::overwrites_edges::case_2 ... \u001b[32mok\u001b(B\u001b[m
test ops::overwrites_edges::case_5 ... \u001b[32mok\u001b(B\u001b[m
test ops::replaces_ignoring_locator ... \u001b[32mok\u001b(B\u001b[m
test ops::splits_label_correctly::case_1 ... \u001b[32mok\u001b(B\u001b[m
test ops::splits_label_correctly::case_2 ... \u001b[32mok\u001b(B\u001b[m
test ops::overwrites_edges::case_4 ... \u001b[32mok\u001b(B\u001b[m
test ops::sets_simple_data ... \u001b[32mok\u001b(B\u001b[m
test ops::splits_label_correctly::case_3 ... \u001b[32mok\u001b(B\u001b[m
test ops::overwrites_edges::case_3 ... \u001b[32mok\u001b(B\u001b[m
test ops::pre_defined_ids ... \u001b[32mok\u001b(B\u001b[m
test ops::splits_label_correctly::case_4 ... \u001b[32mok\u001b(B\u001b[m
test vertex::makes_an_empty_vertex ... \u001b[32mok\u001b(B\u001b[m
test ops::checks_for_data_presence ... \u001b[32mok\u001b(B\u001b[m
test serialization::saves_and_loads ... \u001b[32mok\u001b(B\u001b[m
test slice::makes_a_slice ... \u001b[32mok\u001b(B\u001b[m
test xml::prints_simple_graph ... \u001b[32mok\u001b(B\u001b[m
test script::simple_command ... \u001b[32mok\u001b(B\u001b[m

failures:

---- merge::merges_data stdout ----
TRACE [sodg::ops] #add(ν1): new vertex added
TRACE [sodg::ops] #add(ν1): new vertex added
TRACE [sodg::ops] #data: data of ν1 set to 00-00-00-00-00-00-00-2A
\u001b[35mDEBUG\u001b[0m [sodg::merge] Merged 1 vertices into the existing Sodg
thread 'merge::merges_data' panicked at 'assertion failed: `(left == right)`
  left: `1`,
 right: `0`: the test returned a termination value with a non-zero status code (1) which indicates a failure', /rustc/4b91a6ea7258a947e59c6522cd5898e7c0a6a88f/library/test/src/lib.rs:184:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


failures:
    merge::merges_data

test result: \u001b[31mFAILED\u001b(B\u001b[m. 86 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s

error: test failed, to rerun pass '--lib'
container c0a28f242e18f4acdaffc384b3cc1ef533cc380d3420f930e771e692c1cb5475 is dead
Fri 17 Feb 2023 03:42:31 AM CET

@l3r8yJ
Copy link
Contributor Author

l3r8yJ commented Feb 17, 2023

@yegor256 i merged the master into my local branch, and it passes all the tests:

    Finished test [unoptimized + debuginfo] target(s) in 0.14s
     Running unittests src/lib.rs (target/debug/deps/sodg-4a281b74efdcbc0e)

running 96 tests
test ctors::makes_an_empty_sodg ... ok
test alerts::dont_panic_when_alerts_disabled ... ok
test clone::makes_a_clone ... ok
test alerts::panic_on_simple_alert ... ok
test alerts::panic_on_complex_alert ... ok
test ctors::prohibits_labels_with_dot ... ok
test ctors::prohibits_labels_of_broken_format::case_3 ... ok
test ctors::prohibits_empty_labels ... ok
test ctors::prohibits_labels_of_broken_format::case_1 ... ok
test ctors::prohibits_labels_with_empty_tail ... ok
test ctors::prohibits_labels_of_broken_format::case_2 ... ok
test ctors::prohibits_loops ... ok
test debug::prints_itself ... ok
test edge::makes_an_empty_edge ... ok
test ctors::prohibits_orphan_edges ... ok
test find::finds_root ... ok
test hex::broken_float_from_small_data ... ok
test hex::broken_int_from_small_data ... ok
test hex::compares_with_data ... ok
test find::finds_with_closure ... ok
test find::closure_return_absolute_vertex ... ok
test find::relay_modifies_sodg_back ... ok
test find::finds_with_locator ... ok
test hex::direct_access_to_vec ... ok
test dot::simple_graph_to_dot ... ok
test hex::empty_string ... ok
test hex::concat_test ... ok
test hex::correct_equality ... ok
test hex::makes_string ... ok
test hex::measures_length ... ok
test hex::non_utf8_string ... ok
test hex::not_enough_data_for_float ... ok
test hex::not_enough_data_for_int ... ok
test hex::prints_bytes ... ok
test hex::prints_empty_bytes ... ok
test hex::simple_bool ... ok
test hex::simple_float ... ok
test hex::simple_int ... ok
test hex::takes_one_byte ... ok
test hex::takes_tail ... ok
test hex::too_much_data_for_int ... ok
test inspect::inspects_simple_object ... ok
test merge::finds_siblings ... ok
test merge::avoids_simple_duplicates ... ok
test merge::ignores_double_parents ... ok
test merge::merges_connected_singletons ... ok
test merge::merges_into_empty_graph ... ok
test merge::merges_data ... ok
test merge::merges_simple_loop ... ok
test merge::merges_singletons ... ok
test merge::merges_large_loop ... ok
test merge::merges_large_identical_graphs ... ok
test merge::merges_two_graphs ... ok
test merge::mixed_injection ... ok
test merge::two_roots ... ok
test misc::checks_for_emptiness ... ok
test merge::understands_same_name_kids ... ok
test next::calculates_next_id ... ok
test merge::zero_to_zero ... ok
test next::simple_next_id ... ok
test ops::adds_simple_vertex ... ok
test ops::adds_twice ... ok
test ops::binds_simple_vertices ... ok
test ops::binds_to_root ... ok
test ops::binds_two_names ... ok
test ops::builds_list_of_kids ... ok
test ops::check_for_data_receiving_before_put ... ok
test ops::checks_for_data_absence ... ok
test ops::checks_for_data_presence ... ok
test ops::checks_for_put_called_once ... ok
test ops::checks_for_put_make_vert_full ... ok
test ops::finds_all_kids ... ok
test ops::finds_kid_and_loc_by_prefix ... ok
test ops::finds_kid_by_prefix ... ok
test ops::gets_absent_kid ... ok
test ops::gets_data_from_empty_vertex ... ok
test ops::gets_kid_from_absent_vertex ... ok
test ops::overwrites_edge ... ok
test ops::overwrites_edges::case_1 ... ok
test ops::overwrites_edges::case_2 ... ok
test ops::overwrites_edges::case_3 ... ok
test ops::overwrites_edges::case_4 ... ok
test ops::overwrites_edges::case_5 ... ok
test ops::pre_defined_ids ... ok
test ops::replaces_ignoring_locator ... ok
test ops::sets_simple_data ... ok
test ops::splits_label_correctly::case_1 ... ok
test ops::splits_label_correctly::case_2 ... ok
test ops::splits_label_correctly::case_3 ... ok
test ops::splits_label_correctly::case_4 ... ok
test vertex::makes_an_empty_vertex ... ok
test slice::makes_a_slice ... ok
test serialization::saves_and_loads ... ok
test merge::two_big_graphs ... ok
test xml::prints_simple_graph ... ok
test script::simple_command ... ok

test result: ok. 96 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.01s

   Doc-tests sodg

running 44 tests
test src/hex.rs - hex::Hex::byte_at (line 316) ... ok
test src/hex.rs - hex::Hex (line 31) ... ok
test src/dot.rs - dot::Sodg::to_dot (line 30) ... ok
test src/hex.rs - hex::Hex (line 39) ... ok
test src/hex.rs - hex::Hex::concat (line 344) ... ok
test src/hex.rs - hex::Hex::bytes (line 89) ... ok
test src/find.rs - find::Sodg::find (line 92) ... ok
test src/alerts.rs - alerts::Sodg::alert_on (line 37) ... ok
test src/hex.rs - hex::Hex::empty (line 75) ... ok
test src/hex.rs - hex::Hex::from (line 379) ... ok
test src/hex.rs - hex::Hex::from (line 394) ... ok
test src/hex.rs - hex::Hex::from (line 410) ... ok
test src/hex.rs - hex::Hex::from_slice (line 129) ... ok
test src/hex.rs - hex::Hex::from_str (line 427) ... ok
test src/hex.rs - hex::Hex::from_str (line 440) ... ok
test src/hex.rs - hex::Hex::from_str_bytes (line 185) ... ok
test src/hex.rs - hex::Hex::from_string_bytes (line 172) ... ok
test src/hex.rs - hex::Hex::from_vec (line 155) ... ok
test src/hex.rs - hex::Hex::is_empty (line 198) ... ok
test src/hex.rs - hex::Hex::len (line 105) ... ok
test src/hex.rs - hex::Hex::len (line 113) ... ok
test src/hex.rs - hex::Hex::print (line 274) ... ok
test src/hex.rs - hex::Hex::print (line 282) ... ok
test src/hex.rs - hex::Hex::print (line 290) ... ok
test src/hex.rs - hex::Hex::tail (line 331) ... ok
test src/hex.rs - hex::Hex::to_bool (line 211) ... ok
test src/hex.rs - hex::Hex::to_f64 (line 241) ... ok
test src/hex.rs - hex::Hex::to_i64 (line 224) ... ok
test src/hex.rs - hex::Hex::to_utf8 (line 258) ... ok
test src/lib.rs - (line 31) ... ok
test src/lib.rs - Sodg (line 80) ... ok
test src/misc.rs - misc::Sodg::is_empty (line 30) ... ok
test src/ops.rs - ops::Sodg::add (line 34) ... ok
test src/ops.rs - ops::Sodg::bind (line 57) ... ok
test src/ops.rs - ops::Sodg::data (line 126) ... ok
test src/ops.rs - ops::Sodg::data (line 144) ... ok
test src/ops.rs - ops::Sodg::full (line 243) ... ok
test src/ops.rs - ops::Sodg::kid (line 218) ... ok
test src/ops.rs - ops::Sodg::kids (line 173) ... ok
test src/ops.rs - ops::Sodg::kids (line 189) ... ok
test src/ops.rs - ops::Sodg::put (line 95) ... ok
test src/script.rs - script::Script::from_str (line 62) ... ok
test src/vertex.rs - vertex::Vertex::empty (line 39) ... ok
test src/xml.rs - xml::Sodg::to_xml (line 31) ... ok

test result: ok. 44 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 4.23s

@l3r8yJ
Copy link
Contributor Author

l3r8yJ commented Feb 17, 2023

@yegor256 can you restart the workflows, i want to see the logs again

@l3r8yJ
Copy link
Contributor Author

l3r8yJ commented Feb 18, 2023

@yegor256 take a look, please

@yegor256
Copy link
Member

@l3r8yJ I would suggest to drop this task, since I already made similar changes in another ticket. I'm sorry for this conflict, but it was urgent! I suggest, if you want to get into this project, to start with adding unit tests to existing functionality. There are a few tickets about that. This will be safe, won't cause conflicts (I hope)

@l3r8yJ
Copy link
Contributor Author

l3r8yJ commented Feb 18, 2023

@yegor256 got it, i'll take a look.

@l3r8yJ l3r8yJ closed this Feb 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

data must be immutable in a vertex
4 participants