Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed WireType.CSV when using enums #85

Closed
RobAustin opened this issue May 15, 2018 · 2 comments
Closed

Fixed WireType.CSV when using enums #85

RobAustin opened this issue May 15, 2018 · 2 comments
Assignees

Comments

@RobAustin
Copy link
Contributor

The following test fails

import net.openhft.chronicle.wire.WireType;
import org.jetbrains.annotations.NotNull;
import org.junit.Ignore;
import org.junit.Test;

import java.io.IOException;
import java.util.*;

/**
 * Created by peter.lawrey@chronicle.software on 16/05/2017.
 */
public class CcyTest {

    Set<CcyPair> europeanCcyPairs = EnumSet.of(CcyPair.EURCHF,
            CcyPair.EURGBP,
            CcyPair.EURDKK,
            CcyPair.EURNOK,
            CcyPair.EURSEK,
            CcyPair.EURCZK,
            CcyPair.EURHUF,
            CcyPair.EURPLN);



    @Test
    public void checkCcy() throws IOException {
        @NotNull Map<String, String> map = new LinkedHashMap<>();
        WireType.CSV.streamFromFile(ISO4217.class, "ISO-4217.csv")
                .forEach(i -> map.put(i.AlphabeticCode, i.Currency));
        Ccy[] values = Ccy.values();
        Arrays.sort(values, Comparator.comparing(Enum::name));
        for (@NotNull Ccy ccy : values) {
            String s = map.get(ccy.name());
            if (s == null)
                throw new AssertionError("Non standard currency code " + ccy);
            System.out.println(ccy + ", // " + s);
        }
        // check that we are in sync with RBC's covariance calculator.
        assert values.length == 21;
        assert Ccy.AUD.ordinal() == 0;
        assert Ccy.CAD.ordinal() == 1;
        assert Ccy.CHF.ordinal() == 2;
        assert Ccy.CNH.ordinal() == 3;
        assert Ccy.CZK.ordinal() == 4;
        assert Ccy.DKK.ordinal() == 5;
        assert Ccy.EUR.ordinal() == 6;
        assert Ccy.GBP.ordinal() == 7;
        assert Ccy.HKD.ordinal() == 8;
        assert Ccy.HUF.ordinal() == 9;
        assert Ccy.ILS.ordinal() == 10;
        assert Ccy.JPY.ordinal() == 11;
        assert Ccy.MXN.ordinal() == 12;
        assert Ccy.NOK.ordinal() == 13;
        assert Ccy.NZD.ordinal() == 14;
        assert Ccy.PLN.ordinal() == 15;
        assert Ccy.SEK.ordinal() == 16;
        assert Ccy.SGD.ordinal() == 17;
        assert Ccy.TRY.ordinal() == 18;
        assert Ccy.ZAR.ordinal() == 19;
        assert Ccy.USD.ordinal() == 20;
    }
@hft-team-city
Copy link
Collaborator

@hft-team-city
Copy link
Collaborator

Released in Chronicle-Wire-2.20.101, BOM-2.20.134

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants