fluo-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From keith-turner <...@git.apache.org>
Subject [GitHub] incubator-fluo pull request #825: fixes #823
Date Mon, 24 Apr 2017 14:55:27 GMT
Github user keith-turner commented on a diff in the pull request:

    https://github.com/apache/incubator-fluo/pull/825#discussion_r112968192
  
    --- Diff: modules/api/src/test/java/org/apache/fluo/api/data/BytesTest.java ---
    @@ -79,6 +79,19 @@ public void testHashSubsequence() {
       }
     
       @Test
    +  public void testPrefixSuffix() {
    +    Bytes b1 = Bytes.of("abcde");
    +    Bytes prefix = Bytes.of("ab");
    +    Bytes suffix = Bytes.of("de");
    +    Bytes mid = Bytes.of("cd");
    +
    +    Assert.assertEquals(true, b1.startsWith(prefix));
    +    Assert.assertEquals(true, b1.endsWith(suffix));
    +    Assert.assertEquals(false, b1.startsWith(mid));
    +    Assert.assertEquals(false, b1.endsWith(mid));
    --- End diff --
    
    Some test cases that compare with self would be nice.  I have had problems in the past
with implementations that do not properly handle this case.  Also, test with subsequence (which
will create a new Bytes that has the same inner array) would be nice.
    
    ```java
      assertTrue(b1.startsWith(b1));
      assertTrue(b1.endsWith(b1));
      assertTrue(b1.startsWith(b1.subSequence(0,2));
      assertFalse(b1.subSequence(0,2).startsWith(b1));
      //do similar test with subseq and endswith
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message