[ 
https://issues.apache.org/jira/browse/METRON-364?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15729916#comment-15729916
 ] 

ASF GitHub Bot commented on METRON-364:
---------------------------------------

Github user cestella commented on a diff in the pull request:

    https://github.com/apache/incubator-metron/pull/390#discussion_r91386719
  
    --- Diff: 
metron-platform/metron-common/src/test/java/org/apache/metron/common/stellar/StellarTest.java
 ---
    @@ -56,6 +56,37 @@
     public class StellarTest {
     
       @Test
    +  public void addingLongsShouldYieldLong() throws Exception {
    +    final long timestamp = 1452013350000L;
    +    String query = "TO_EPOCH_TIMESTAMP('2016-01-05 17:02:30', 'yyyy-MM-dd 
HH:mm:ss', 'UTC') + 2";
    +    Assert.assertEquals(timestamp + 2, run(query, new HashMap<>()));
    +  }
    +
    +  @Test
    +  public void addingIntegersShouldYieldAnInteger() throws Exception {
    +    String query = "1 + 2";
    +    Assert.assertEquals(3, run(query, new HashMap<>()));
    +  }
    +
    +  @Test
    +  public void addingDoublesShouldYieldADouble() throws Exception {
    +    String query = "1.0 + 2.0";
    +    Assert.assertEquals(3.0, run(query, new HashMap<>()));
    +  }
    +
    +  @Test
    +  public void 
addingDoubleAndIntegerWhereSubjectIsDoubleShouldYieldADouble() throws Exception 
{
    +    String query = "2.1 + 1";
    +    Assert.assertEquals(3.1, run(query, new HashMap<>()));
    +  }
    +
    +  @Test
    +  public void 
addingDoubleAndIntegerWhereSubjectIsIntegerShouldYieldADouble() throws 
Exception {
    +    String query = "1 + 2.1";
    +    Assert.assertEquals(3.1, run(query, new HashMap<>()));
    +  }
    --- End diff --
    
    Obviously, the same set for multiplication and division.  I'd parameterize 
that case ;)


> Stellar - Adding Two Integers Does Not Equal an Integer
> -------------------------------------------------------
>
>                 Key: METRON-364
>                 URL: https://issues.apache.org/jira/browse/METRON-364
>             Project: Metron
>          Issue Type: Bug
>            Reporter: Nick Allen
>              Labels: stellar
>
> A test showing the problem which would be part of 
> org.apache.metron.common.stellar.StellarTest  
> ```java
>       @Test
>       public void testAddIntegers()  throws Exception {
>         String query = "1 + 1";
>         Assert.assertEquals(2, run(query, new HashMap<>()));
>     //    java.lang.AssertionError:
>     //    Expected :2
>     //    Actual   :2.0
>       }
> ```



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to