/*
 * Copyright (c) nosqlbench
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package io.nosqlbench.nb.api.engine.activityimpl;

import org.junit.jupiter.api.Test;

import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.jupiter.api.Assertions.*;

public class CyclesSpecTest {

    @Test
    public void testSingleNumberSpec() {
        assertThat(CyclesSpec.parse("100")).isEqualTo(
            new CyclesSpec(0,100,"0","100")
        );
    }

    @Test
    public void testIntervalSpec() {
        assertThat(CyclesSpec.parse("3..13")).isEqualTo(
            new CyclesSpec(3,13,"3","13")
        );
    }

    @Test
    public void testUnitsSupport() {
        assertThat(CyclesSpec.parse("5M")).isEqualTo(
            new CyclesSpec(0,5_000_000L,"0","5M")
        );
    }

    @Test
    public void testIncrementalSupport() {
        assertThat(CyclesSpec.parse("5M..+100")).isEqualTo(
            new CyclesSpec(5_000_000L,5_000_100L,"5M","+100")
        );
    }

    @Test
    public void testIncrementalUnitsSupport() {
        assertThat(CyclesSpec.parse("5M..+1M")).isEqualTo(
            new CyclesSpec(5_000_000L,6_000_000L,"5M","+1M")
        );
    }
}
