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

delete function for AlignedString does not work properly #1482

Open
topn0tch opened this issue Aug 26, 2020 · 1 comment
Open

delete function for AlignedString does not work properly #1482

topn0tch opened this issue Aug 26, 2020 · 1 comment
Labels
🐛Bug Something isn't working Module-api.transform

Comments

@topn0tch
Copy link

topn0tch commented Aug 26, 2020

With the following unit test (AlignedStringTest.java)

@Test
    public void testHtmlDelete() {
        ArrayList<ImmutableInterval> list = new ArrayList<>();
        list.add(new ImmutableInterval(0, 3));
        list.add(new ImmutableInterval(8, 11));
        list.add(new ImmutableInterval(16, 20));
        list.add(new ImmutableInterval(20, 24));
        Collections.reverse(list);
        String short_html = "<p>Hello<p>World</p></p>";
        AlignedString base = new AlignedString(short_html);
        for (ImmutableInterval i : list) {
            base.delete(i.getStart(), i.getEnd());
        }
        System.out.println("Base      : " + base.get() + " - " + base.dataSegmentsToString());
        Collections.reverse(list);
        assertEquals(new ImmutableInterval(0, 0), base.inverseResolve(list.get(0)));
        assertEquals(new ImmutableInterval(5, 5), base.inverseResolve(list.get(1)));
        assertEquals(new ImmutableInterval(10, 10), base.inverseResolve(list.get(2)));
        assertEquals(new ImmutableInterval(10, 10), base.inverseResolve(list.get(3)));
    }

We get the following output:

Base      : HelloWorld - >>[][Hello][World][][]<< (A:0)(O:0[]0)(O:0[Hello]5)(O:5[World]10)(O:10[]10)(O:10[]10)(A:10)

java.lang.AssertionError: 
Expected :[5-5]
Actual   :[10-10]

Assuming that the empty brackets represent the html tags, we've noticed that the "p" tag between Hello and World in the output is missing.

@reckart reckart added Module-api.transform 🐛Bug Something isn't working labels Jan 16, 2021
@reckart reckart added this to the Bug backlog milestone Jan 16, 2021
@reckart
Copy link
Member

reckart commented Jan 16, 2021

Thanks for reporting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛Bug Something isn't working Module-api.transform
Projects
None yet
Development

No branches or pull requests

2 participants