f7
f7 is a spreadsheet formula execution library
git clone https://git.vogt.world/f7.git
Log | Files | README.md | LICENSE.md
← All files
name: src/test/java/io/protobase/f7/formulas/math/RANDTest.java
-rw-r--r--
617
 1package io.protobase.f7.formulas.math;
 2
 3import io.protobase.f7.errors.NAException;
 4import io.protobase.f7.testutils.TestFormula;
 5import org.junit.Test;
 6
 7import static com.google.common.truth.Truth.assertThat;
 8
 9public class RANDTest extends TestFormula {
10
11  @Test
12  public void testApply() {
13    for (int i = 0; i < 100000; i++) {
14      Double one = ((Double) RAND.SELF.apply(null));
15      assertThat(one).isAtLeast(0.0);
16      assertThat(one).isAtMost(1.0);
17    }
18  }
19
20  @Test
21  public void testApply_errorFromArgumentsMismatch() {
22    assertThat(RAND.SELF.apply(null, "Too many")).isEqualTo(new NAException());
23  }
24}