Пример #1
0
    void runTest ()
    {
        beginTestCase ("Seed");
        RippleAddress seed;
        expect (seed.setSeedGeneric ("masterpassphrase"));
        expect (seed.humanSeed () == "snoPBrXtMeMyMHUVTgbuqAfg1SUTb", seed.humanSeed ());

        beginTestCase ("RipplePublicKey");
        RippleAddress deprecatedPublicKey (RippleAddress::createNodePublic (seed));
        expect (deprecatedPublicKey.humanNodePublic () ==
            "n94a1u4jAz288pZLtw6yFWVbi89YamiC6JBXPVUj5zmExe5fTVg9",
                deprecatedPublicKey.humanNodePublic ());
        RipplePublicKey publicKey (deprecatedPublicKey);
        expect (publicKey.to_string() == deprecatedPublicKey.humanNodePublic(),
            publicKey.to_string());

        beginTestCase ("RipplePrivateKey");
        RippleAddress deprecatedPrivateKey (RippleAddress::createNodePrivate (seed));
        expect (deprecatedPrivateKey.humanNodePrivate () ==
            "pnen77YEeUd4fFKG7iycBWcwKpTaeFRkW2WFostaATy1DSupwXe",
                deprecatedPrivateKey.humanNodePrivate ());
        RipplePrivateKey privateKey (deprecatedPrivateKey);
        expect (privateKey.to_string() == deprecatedPrivateKey.humanNodePrivate(),
            privateKey.to_string());

        beginTestCase ("Generator");
        RippleAddress generator (RippleAddress::createGeneratorPublic (seed));
        expect (generator.humanGenerator () ==
            "fhuJKrhSDzV2SkjLn9qbwm5AaRmrxDPfFsHDCP6yfDZWcxDFz4mt",
                generator.humanGenerator ());

        beginTestCase ("RippleAccountID");
        RippleAddress deprecatedAccountPublicKey (
            RippleAddress::createAccountPublic (generator, 0));
        expect (deprecatedAccountPublicKey.humanAccountID () ==
            "rHb9CJAWyB4rj91VRWn96DkukG4bwdtyTh",
                deprecatedAccountPublicKey.humanAccountID ());
        RippleAccountID accountID (deprecatedAccountPublicKey);
        expect (accountID.to_string() ==
            deprecatedAccountPublicKey.humanAccountID(),
                accountID.to_string());

        beginTestCase ("RippleAccountPublicKey");
        expect (deprecatedAccountPublicKey.humanAccountPublic () ==
            "aBQG8RQAzjs1eTKFEAQXr2gS4utcDiEC9wmi7pfUPTi27VCahwgw",
                deprecatedAccountPublicKey.humanAccountPublic ());

        beginTestCase ("RippleAccountPrivateKey");
        RippleAddress deprecatedAccountPrivateKey (
            RippleAddress::createAccountPrivate (generator, seed, 0));
        expect (deprecatedAccountPrivateKey.humanAccountPrivate () ==
            "p9JfM6HHi64m6mvB6v5k7G2b1cXzGmYiCNJf6GHPKvFTWdeRVjh",
                deprecatedAccountPrivateKey.humanAccountPrivate ());
        RippleAccountPrivateKey accountPrivateKey (deprecatedAccountPrivateKey);
        expect (accountPrivateKey.to_string() ==
            deprecatedAccountPrivateKey.humanAccountPrivate(),
                privateKey.to_string());
    }
Пример #2
0
    void run ()
    {
        testcase ("Seed");
        RippleAddress seed;
        expect (seed.setSeedGeneric ("masterpassphrase"));
        expect (seed.humanSeed () == "snoPBrXtMeMyMHUVTgbuqAfg1SUTb", seed.humanSeed ());

        testcase ("RipplePublicKey");
        RippleAddress deprecatedPublicKey (RippleAddress::createNodePublic (seed));
        expect (deprecatedPublicKey.humanNodePublic () ==
            "n94a1u4jAz288pZLtw6yFWVbi89YamiC6JBXPVUj5zmExe5fTVg9",
                deprecatedPublicKey.humanNodePublic ());
        RipplePublicKey publicKey = deprecatedPublicKey.toPublicKey();
        expect (publicKey.to_string() == deprecatedPublicKey.humanNodePublic(),
            publicKey.to_string());

        testcase ("Generator");
        RippleAddress generator (RippleAddress::createGeneratorPublic (seed));
        expect (generator.humanGenerator () ==
            "fhuJKrhSDzV2SkjLn9qbwm5AaRmrxDPfFsHDCP6yfDZWcxDFz4mt",
                generator.humanGenerator ());
    }