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

Add merge and split concurrency tests #780

Merged
merged 6 commits into from
Feb 6, 2024
Merged

Conversation

justiceHui
Copy link
Member

@justiceHui justiceHui commented Jan 30, 2024

What this PR does / why we need it:

Tests (144 + 84 + 900 + 320 + 144 = 1592 cases)

  • Style and Style(4 * 6 * 6 = 144 cases):
    • Ranges(4)
      • A = B
      • A contains B
      • A and B are intersecting
      • not intersecting
    • Operations for both A and B(6)
      • RemoveStyle({'bold'})
      • Style({'bold': 'aa'})
      • Style({'bold': 'bb'})
      • RemoveStyle({'italic'})
      • Style({'italic': 'aa'})
      • Style({'italic': 'bb'})
  • Edit and Style(7 * 6 * 2 = 84 cases):
    • Ranges(7)
      • A = B, A and B contain single element
      • [ADDED] A = B, A and B contain multiple elements
      • A contains B
      • B contains A
      • A and B are intersecting
      • B is next to A
      • A is next to B
    • Operations for A(6)
      • Insert front of range
      • Insert back of range
      • Insert middle of range
      • Delete
      • Replace
      • [ADDED] Merge
    • Operations for B(2)
      • RemoveStyle({'bold'})
      • Style({'bold': 'aa'})
  • Edit and Edit(9 * 10 * 10 = 900 cases):
    • Ranges(9)
      • A and B are intersecting (element)
      • A and B are intersecting (text)
      • A contains B (element)
      • A contains B (text)
      • A contains B (A is element, B is text)
      • B is next to A (element)
      • B is next to A (text)
      • A = B (element)
      • A = B (text)
    • Operations for both A and B(10)
      • Insert text front of range
      • Insert text middle of range
      • Insert text back of range
      • Replace to text node
      • Insert element front of range
      • Insert element middle of range
      • Insert element back of range
      • Replace to element node
      • Delete
      • [ADDED] Merge
  • [ADDED] Split and Split(5 * 8 * 8 = 320 cases)
    • Ranges(5)
      • Equals, single element
      • Equals, multiple element
      • A contains B, same level
      • A contains B, multiple level
      • B is next to A
    • Operations for both A and B(8)
      • Split front of range, level = 1
      • Split front of range, level = 2
      • Split one-quarter of range, level = 1
      • Split one-quarter of range, level = 2
      • Split three-quarter of range, level = 1
      • Split three-quarter of range, level = 2
      • Split back of range, level = 1
      • Split back of range, level = 2
  • [ADDED] Split and Edit(9 * 2 * 8 = 144 cases):
    • Ranges(9)
      • Equals
      • A contains B
      • B contains A
      • Left node(text) of split node
      • Right node(text) of split node
      • Left node(element) of split node
      • Right node(element) of split node
      • B is next to A
      • A is next to B
    • Operations for A(2)
      • splitLevel = 1
      • splitLevel = 2
    • Operations for B(8)
      • Insert front of range
      • Insert back of range
      • Insert middle of range
      • Delete
      • Replace
      • Merge
      • Style
      • RemoveStyle

Failure cases (0 + 15 + 3 + 60 + 46 = 124/1592 cases)

  • Style and Style (0/144 cases)
  • Edit and Style (15/84 cases)
    • (6) {equal, equal-multiple} / {insert-front, insert-middle, replace} / style
    • (4) {intersect, A -> B} / {insert-middle, insert-back} / style
    • (1) A contains B / insert-middle / style
    • (4) B contains A / {insert-front, insert-middle, insert-back, replace} / style
  • Edit and Edit (3/900 cases)
    • (1) intersect-element / merge / replace-text
      • d1: <root><p>abcdef</p>B</root>
      • d2: <root><p>abc</p>B</root>
    • (1) intersect-element / merge / replace-element
      • d1: <root><p>abcdef</p><i></i></root>
      • d2: <root><p>abc</p><i></i></root>
    • (1) intersect-element / merge / delete
      • d1: <root><p>abcdef</p></root>
      • d2: <root><p>abc</p></root>
  • Split and Split (60/320 cases)
    • (1) equal-single / split-one-quarter-1 / split-back-1
    • (1) equal-single / split-three-quarter-1 / split-back-1
    • (1) equal-multiple / split-three-quarter-1 / split-back-1
    • (1) A contains B same level / split-one-quarter-1 / split-front-1
    • (1) A contains B same level / split-three-quarter-1 / split-back-1
    • (1) A -> B / split-one-quarter-1 / split-front-1
    • (1) A -> B / split-three-quarter-1 / split-back-1
    • (53) and many cases with splitLevel > 1
  • Split and Edit (46/144 cases)
    • (6) equals / {split-1, split-2} / {insert-back, replace, delete}
    • (8) A contains B / {split-1, split-2} / {replace, delete, style, remove-style}
    • (8) B contains A / {split-1, split-2} / {insert-middle, replace, delete, style}
    • (1) B contains A / split-2 / remove-style
    • (8) {right node text, right node element} / {split-1, split-2} / {style, remove-style}
    • (4) {right node text, right node element} / split-2 / {replace, delete}
    • (8) A -> B / {split-1, split-2} / {insert-front, replace, delete, style}
    • (1) A -> B / split-2 / remove-style
    • (2) B -> A / split-2 / {replace, delete}

Checklist:

  • Added relevant tests or not required
  • Didn't break anything

Copy link

codecov bot commented Jan 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (0cdb329) 50.71% compared to head (1391447) 50.71%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #780   +/-   ##
=======================================
  Coverage   50.71%   50.71%           
=======================================
  Files          70       70           
  Lines       10213    10213           
=======================================
  Hits         5180     5180           
  Misses       4512     4512           
  Partials      521      521           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@justiceHui justiceHui marked this pull request as ready for review January 31, 2024 09:00
@hackerwins hackerwins self-requested a review February 6, 2024 07:49
Copy link
Member

@hackerwins hackerwins left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution.

@hackerwins hackerwins changed the title Add merge concurrency test Add merge and split concurrency tests Feb 6, 2024
@hackerwins hackerwins merged commit 94d6e30 into main Feb 6, 2024
4 checks passed
@hackerwins hackerwins deleted the tree-merge-style-test branch February 6, 2024 07:52
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.

2 participants