-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: fixed history build for era for preview and sanchonet (#15)
* chore: fixed history build for era for preview and sanchonet * chore: removed formatting tool * chore: fixed test, restored fmt plugin
- Loading branch information
Showing
3 changed files
with
250 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
107 changes: 107 additions & 0 deletions
107
src/test/java/org/cardanofoundation/conversions/GenesisConfigPreviewTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
package org.cardanofoundation.conversions; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.cardanofoundation.conversions.domain.EraType.*; | ||
import static org.cardanofoundation.conversions.domain.NetworkType.PREVIEW; | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import java.time.Duration; | ||
import java.time.LocalDateTime; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Disabled; | ||
import org.junit.jupiter.api.Test; | ||
|
||
@Slf4j | ||
class GenesisConfigPreviewTest { | ||
|
||
private static GenesisConfig genesisConfig; | ||
|
||
@BeforeEach | ||
public void setup() { | ||
var conversionsConfig = ClasspathConversionsFactory.create(PREVIEW); | ||
var eraHistory = StaticEraHistoryFactory.create(conversionsConfig.genesisPaths()); | ||
|
||
genesisConfig = new GenesisConfig(conversionsConfig, eraHistory, new ObjectMapper()); | ||
} | ||
|
||
@Test | ||
public void testByronSlotDuration() { | ||
assertThat(genesisConfig.slotDuration(Byron)).isEqualTo(Duration.ofSeconds(20)); | ||
} | ||
|
||
@Test | ||
public void testShelleySlotDuration() { | ||
assertThat(genesisConfig.slotDuration(Shelley)).isEqualTo(Duration.ofSeconds(1)); | ||
} | ||
|
||
@Test | ||
public void testAlonzoSlotDuration() { | ||
assertThat(genesisConfig.slotDuration(Alonzo)).isEqualTo(Duration.ofSeconds(1)); | ||
} | ||
|
||
@Test | ||
public void testByronSlotsPerEpoch() { | ||
assertThat(genesisConfig.slotsPerEpoch(Byron)).isEqualTo(4320L); | ||
} | ||
|
||
@Test | ||
public void testShelleySlotsPerEpoch() { | ||
assertThat(genesisConfig.slotsPerEpoch(Shelley)).isEqualTo(86400L); | ||
} | ||
|
||
@Test | ||
public void testAllegraSlotsPerEpoch() { | ||
assertThat(genesisConfig.slotsPerEpoch(Allegra)).isEqualTo(86400L); | ||
} | ||
|
||
@Test | ||
@Disabled("there is no byron in preview") | ||
public void testLastByronEpoch() { | ||
assertThat(genesisConfig.lastByronEpochNo()).isEqualTo(-1); | ||
} | ||
|
||
@Test | ||
public void testFirstShelleyEpoch() { | ||
assertThat(genesisConfig.firstShelleyEpochNo()).isEqualTo(0); | ||
} | ||
|
||
@Test | ||
@Disabled("there is no byron in preview") | ||
public void testLastByronSlot() { | ||
assertThat(genesisConfig.lastByronSlot()).isEqualTo(4492799); | ||
} | ||
|
||
@Test | ||
public void testPrimitiveNetworkStartTime() { | ||
assertThat(genesisConfig.getCardanoNetworkStartTime()).isEqualTo(1666656000L); | ||
} | ||
|
||
@Test | ||
public void testNetworkStartTime() { | ||
assertThat(genesisConfig.getStartTime()).isEqualTo(LocalDateTime.of(2022, 10, 25, 0, 0, 0)); | ||
} | ||
|
||
@Test | ||
public void testProtocolMagic() { | ||
assertThat(genesisConfig.getProtocolNetworkMagic()).isEqualTo(2L); | ||
} | ||
|
||
@Test | ||
public void testBlockTimeNetworkBeginning() { | ||
assertThat(genesisConfig.blockTime(Byron, 0)).isEqualTo(genesisConfig.getStartTime()); | ||
} | ||
|
||
@Test | ||
public void testShelleyStartTime() { | ||
assertThat(genesisConfig.getShelleyStartTime()) | ||
.isEqualTo(LocalDateTime.of(2022, 10, 25, 0, 0, 0)); | ||
} | ||
|
||
@Test | ||
// proposal reveal time for Cardano Summit Awards 2023 | ||
public void testBlockTimeNetwork() { | ||
assertThat(genesisConfig.blockTime(Shelley, 46755827L)) | ||
.isEqualTo(LocalDateTime.of(2024, 4, 18, 3, 43, 47)); | ||
} | ||
} |
107 changes: 107 additions & 0 deletions
107
src/test/java/org/cardanofoundation/conversions/GenesisConfigSanchonetTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
package org.cardanofoundation.conversions; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.cardanofoundation.conversions.domain.EraType.*; | ||
import static org.cardanofoundation.conversions.domain.NetworkType.SANCHONET; | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import java.time.Duration; | ||
import java.time.LocalDateTime; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Disabled; | ||
import org.junit.jupiter.api.Test; | ||
|
||
@Slf4j | ||
class GenesisConfigSanchonetTest { | ||
|
||
private static GenesisConfig genesisConfig; | ||
|
||
@BeforeEach | ||
public void setup() { | ||
var conversionsConfig = ClasspathConversionsFactory.create(SANCHONET); | ||
var eraHistory = StaticEraHistoryFactory.create(conversionsConfig.genesisPaths()); | ||
|
||
genesisConfig = new GenesisConfig(conversionsConfig, eraHistory, new ObjectMapper()); | ||
} | ||
|
||
@Test | ||
public void testByronSlotDuration() { | ||
assertThat(genesisConfig.slotDuration(Byron)).isEqualTo(Duration.ofSeconds(20)); | ||
} | ||
|
||
@Test | ||
public void testShelleySlotDuration() { | ||
assertThat(genesisConfig.slotDuration(Shelley)).isEqualTo(Duration.ofSeconds(1)); | ||
} | ||
|
||
@Test | ||
public void testAlonzoSlotDuration() { | ||
assertThat(genesisConfig.slotDuration(Alonzo)).isEqualTo(Duration.ofSeconds(1)); | ||
} | ||
|
||
@Test | ||
public void testByronSlotsPerEpoch() { | ||
assertThat(genesisConfig.slotsPerEpoch(Byron)).isEqualTo(4320L); | ||
} | ||
|
||
@Test | ||
public void testShelleySlotsPerEpoch() { | ||
assertThat(genesisConfig.slotsPerEpoch(Shelley)).isEqualTo(86400L); | ||
} | ||
|
||
@Test | ||
public void testAllegraSlotsPerEpoch() { | ||
assertThat(genesisConfig.slotsPerEpoch(Allegra)).isEqualTo(86400L); | ||
} | ||
|
||
@Test | ||
@Disabled("there is no byron in preview") | ||
public void testLastByronEpoch() { | ||
assertThat(genesisConfig.lastByronEpochNo()).isEqualTo(-1); | ||
} | ||
|
||
@Test | ||
public void testFirstShelleyEpoch() { | ||
assertThat(genesisConfig.firstShelleyEpochNo()).isEqualTo(0); | ||
} | ||
|
||
@Test | ||
@Disabled("there is no byron in preview") | ||
public void testLastByronSlot() { | ||
assertThat(genesisConfig.lastByronSlot()).isEqualTo(4492799); | ||
} | ||
|
||
@Test | ||
public void testPrimitiveNetworkStartTime() { | ||
assertThat(genesisConfig.getCardanoNetworkStartTime()).isEqualTo(1686789000L); | ||
} | ||
|
||
@Test | ||
public void testNetworkStartTime() { | ||
assertThat(genesisConfig.getStartTime()).isEqualTo(LocalDateTime.of(2023, 6, 15, 0, 30, 0)); | ||
} | ||
|
||
@Test | ||
public void testProtocolMagic() { | ||
assertThat(genesisConfig.getProtocolNetworkMagic()).isEqualTo(4L); | ||
} | ||
|
||
@Test | ||
public void testBlockTimeNetworkBeginning() { | ||
assertThat(genesisConfig.blockTime(Byron, 0)).isEqualTo(genesisConfig.getStartTime()); | ||
} | ||
|
||
@Test | ||
public void testShelleyStartTime() { | ||
assertThat(genesisConfig.getShelleyStartTime()) | ||
.isEqualTo(LocalDateTime.of(2023, 6, 15, 0, 30, 0)); | ||
} | ||
|
||
@Test | ||
// proposal reveal time for Cardano Summit Awards 2023 | ||
public void testBlockTimeNetwork() { | ||
assertThat(genesisConfig.blockTime(Shelley, 26735107L)) | ||
.isEqualTo(LocalDateTime.of(2024, 4, 19, 10, 55, 7)); | ||
} | ||
} |