/*
 * Copyright 2019, Yahoo! Inc. Licensed under the terms of the
 * Apache License 2.0. See LICENSE file at the project root for terms.
 */

package com.yahoo.sketches.fdt;

import static org.testng.Assert.assertEquals;

import org.testng.annotations.Test;

/**
 * @author Lee Rhodes
 */
public class GroupTest {
  private static final String LS = System.getProperty("line.separator");

  @Test
  public void checkToString() { //check visually
    Group gp = new Group();
    gp.init("AAAAAAAA,BBBBBBBBBB", 1_000_000, 1E10, 1.2E10, 8E9, 0.1, 0.01);
    assertEquals(gp.getPrimaryKey(), "AAAAAAAA,BBBBBBBBBB");
    assertEquals(gp.getCount(), 1_000_000);
    assertEquals(gp.getEstimate(), 1E10);
    assertEquals(gp.getUpperBound(), 1.2E10);
    assertEquals(gp.getLowerBound(), 8E9);
    assertEquals(gp.getFraction(), 0.1);
    assertEquals(gp.getRse(), 0.01);

    println(gp.getHeader());
    println(gp.toString());
  }

  @Test
  public void printlnTest() {
    println("PRINTING: "+this.getClass().getName());
  }

  /**
   * @param s value to print
   */
  static void println(String s) {
    print(s + LS);
  }

  /**
   * @param s value to print
   */
  static void print(String s) {
    //System.out.print(s);  //disable here
  }

}

@@ -470,16 +470,18 @@
 ();%0A    
+//
 gp.init(
@@ -541,24 +541,101 @@
 0.1, 0.01);%0A
+    gp.init(%22AAAAAAAA,BBBBBBBBBB%22, 100_000_000, 1E8, 1.2E8, 8E7, 0.1, 0.01);%0A
     assertEq
@@ -716,16 +716,18 @@
 unt(), 1
+00
 _000_000
@@ -766,18 +766,17 @@
 te(), 1E
-10
+8
 );%0A    a
@@ -811,18 +811,17 @@
 (), 1.2E
-10
+8
 );%0A    a
@@ -854,17 +854,17 @@
 nd(), 8E
-9
+7
 );%0A    a

Fix value sizes in visual checkToString test.