Ejemplo n.º 1
0
int main(int argc, char* argv[])
{
	Noname test(5, 3);
	std::cout << test.i << "   " << test.d << std::endl;
	Noname test1(test);
	std::cout << test1.i << "   " << test1.d << std::endl;
	Noname test2;
	std::cout << test2.i << "   " << test2.d << std::endl;
	test2 = test1;
	std::cout << test2.i << "   " << test2.d << std::endl;

	if (true)
	{
		Noname testk(5, 5);

	}

	Noname* pNoname = new Noname();
	delete pNoname;


	std::vector<Noname> Novect(5);


	fuck_test1(test);
	fuck_test2(test);
	fuck_test3();
	fuck_test4();

	return 0;
}
Ejemplo n.º 2
0
int main(int argc,char* argv[])  
{  
    Noname test(5,3);  
    std::cout<<test.i<<"   "<<test.d<<std::endl;  
    Noname test1(test);  
    std::cout<<test1.i<<"   "<<test1.d<<std::endl;  
    Noname test2;  
    std::cout<<test2.i<<"   "<<test2.d<<std::endl;  
    test2 =  test1;  
    std::cout<<test2.i<<"   "<<test2.d<<std::endl;  
  
    if(true)  
    {  
        Noname testk(5,5);  
  
    }  
  
    return 0;  
}  
Ejemplo n.º 3
0
int main(int argc, char ** argv)
{
    keystore_t * ks = NULL;
    keystore_t * ksu = NULL;
    identkey_t * idk = NULL;
    khm_size cb;
    void * buf = NULL;
    void * cbuf = NULL;
    khm_handle h = NULL;

    __try {
        ks = ks_keystore_create_new();
        leave_if(ks == NULL);

        testk(ks_keystore_set_string(ks, KCDB_RES_DISPLAYNAME, L"Test keystore"));
        testk(ks_keystore_set_string(ks, KCDB_RES_DESCRIPTION, L"Some description"));
        testk(ks_keystore_set_key_password(ks, "foobarbaz", 10));

        idk = ks_identkey_create_new();
        leave_if(idk == NULL);

        idk->provider_name = _wcsdup(L"Foo provider");
        idk->identity_name = _wcsdup(L"My identity");
        idk->display_name = _wcsdup(L"My identity display name");

        testk(ks_keystore_add_identkey(ks, idk));
        ks_datablob_copy(&idk->plain_key, "This is a plain key", 20, 0);

        printf("\nBefore locking ======\n");
        dump_keystore(ks);

        testk(ks_keystore_lock(ks));

        printf("\nAfter locking ======\n");
        dump_keystore(ks);

        testk(ks_keystore_unlock(ks));

        printf("\nAfter unlocking ======\n");
        dump_keystore(ks);

        testk(ks_keystore_lock(ks));
        testnk(ks_keystore_set_key_password(ks, "wrongpassword", 14));

        cb = 0;
        test_if(ks_keystore_serialize(ks, NULL, &cb) == KHM_ERROR_TOO_LONG);
        printf("\nSize of serialized buffer: %d\n", cb);

        buf = malloc(cb);
        testk(ks_keystore_serialize(ks, buf, &cb));

        printf("Serialized buffer:\n");
        hexdump(buf, cb);

        testk(ks_keystore_unserialize(buf, cb, &ksu));

        printf("Unserialized buffer:\n");
        dump_keystore(ksu);

        testk(khc_memory_store_create(&h));

        {
            khm_int32 i32;

            khm_int64 i64;

            testk(khc_memory_store_add(h, L"A", KC_SPACE, NULL, 0));

            i32 = 12;
            testk(khc_memory_store_add(h, L"IValue", KC_INT32, &i32, sizeof(i32)));

            testk(khc_memory_store_add(h, L"SValue", KC_STRING, L"The rain in Spain stays mainly on the plane?", 1024));

            testk(khc_memory_store_add(h, L"BValue", KC_BINARY,
                                       "Lorem ipsum dolo"
                                       "r sit amet, cons"
                                       "ectetur adipisic"
                                       "ing elit, sed do"
                                       " eiusmod tempor", 79));

            testk(khc_memory_store_add(h, L"New space! This is a new space!", KC_SPACE, NULL, 0));

            testk(khc_memory_store_add(h, L"Fooblarg", KC_SPACE, NULL, 0));

            i64 = 0x9382393029348239i64;
            testk(khc_memory_store_add(h, L"64bit integer value", KC_INT64, &i64, sizeof(i64)));

            testk(khc_memory_store_add(h, L"Bonorum", KC_STRING,
                                       L"Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit, sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla pariatur?",
                                       KCONF_MAXCB_STRING));

            testk(khc_memory_store_add(h, NULL, KC_ENDSPACE, NULL, 0));

            testk(khc_memory_store_add(h, NULL, KC_ENDSPACE, NULL, 0));

            testk(khc_memory_store_add(h, L"Another space! This is a new space!", KC_SPACE, NULL, 0));

            testk(khc_memory_store_add(h, NULL, KC_ENDSPACE, NULL, 0));

            testk(khc_memory_store_add(h, NULL, KC_ENDSPACE, NULL, 0));
        }

        cb = 0;
        test_if(ks_serialize_configuration(h, NULL, &cb) == KHM_ERROR_TOO_LONG);
        test_if(cb > 0);

        cbuf = malloc(cb);
        testk(ks_serialize_configuration(h, cbuf, &cb));

        printf("Serialized configuration:\n");
        hexdump(cbuf, cb);

        testk(khc_memory_store_release(h));

        testk(ks_unserialize_configuration(cbuf, cb, &h));

        {
            int i = 0;
            printf("\nDump of unserialized configuration space:\n");
            testk(khc_memory_store_enum(h, config_dump_cb, &i));
        }

        printf("Success!\n");

    } __finally {
        if (ks)
            ks_keystore_release(ks);
        if (ksu)
            ks_keystore_release(ksu);
        if (buf)
            free(buf);
        if (cbuf)
            free(cbuf);
        if (h)
            khc_memory_store_release(h);
    }

    return 0;
}