This file contains hidden or 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
| ------------------------- MODULE ShuffleVector ------------------------------ | |
| LOCAL INSTANCE Naturals | |
| LOCAL INSTANCE Sequences | |
| LOCAL INSTANCE TLC | |
| (* A Shuffle Vector consists of a sequence of up to N elements. | |
| Adding an element to the shuffle vector pushes an element onto the beginning | |
| of the sequence and swaps it with a random element. | |
| *) |
This file contains hidden or 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
| --------------------------- MODULE MemoryTracking --------------------------- | |
| (* A memory allocator which tracks usage by "phase" *) | |
| CONSTANTS Phase, (* A set of phases *) | |
| Thread, (* A set of threads *) | |
| Address (* A set of addresses *) | |
| VARIABLES memory, (* All in-use allocations *) | |
| memoryByPhase, (* A mapping from phases to sets of allocated items *) | |
| memoryByThread (* A mapping from threads to an allocated record *) |
This file contains hidden or 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
| // +build gofuzz | |
| package test | |
| import ( | |
| "github.com/ontio/ontology/smartcontract" | |
| "github.com/ontio/ontology/core/types" | |
| ) | |
| func Fuzz( data []byte ) int { |
This file contains hidden or 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
| while (!std::cin.eof() ) | |
| { | |
| // pick a random ledger history | |
| std::string curr = ""; | |
| char depth = getBits( maxDepth ); | |
| char offset = 0; | |
| for(char d = 0; d < depth; ++d) | |
| { | |
| char a = offset + getBits( maxWidth ); | |
| curr += a; |
This file contains hidden or 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
| void | |
| testStress() | |
| { | |
| using namespace csf; | |
| LedgerTrie<Ledger> t; | |
| LedgerHistoryHelper h; | |
| // Test quasi-randomly add/remove supporting for different ledgers | |
| // from a branching history. |
This file contains hidden or 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
| const int buf_size = MAX_MESSAGE_SIZE + 1024; | |
| char buf[buf_size]; | |
| int main( int argc, char *argv[] ) { | |
| std::cin.read( buf, buf_size ); | |
| if ( !std::cin.eof() ) { | |
| std::cout << "String too long.\n"; | |
| return 1; | |
| } | |
| size_t size = std::cin.gcount(); |
This file contains hidden or 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
| struct hello_message | |
| { | |
| static const core_message_type_enum type; | |
| std::string user_agent; | |
| uint32_t core_protocol_version; | |
| fc::ip::address inbound_address; | |
| uint16_t inbound_port; | |
| uint16_t outbound_port; | |
| node_id_t node_public_key; |
This file contains hidden or 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
| #include <snappy.h> | |
| #include <iostream> | |
| #include <string> | |
| #include <cstring> | |
| #include <stdlib.h> | |
| const size_t maxInputSize = 10 * 1024 * 1024; | |
| char inputBuf[maxInputSize]; |
This file contains hidden or 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
| template<typename T> | |
| fc::string stringFromStream( T& in ) | |
| ... | |
| while( true ) | |
| { | |
| switch( c = in.peek() ) | |
| { |
This file contains hidden or 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
| #include <fc/variant.hpp> | |
| #include <fc/io/json.hpp> | |
| #include <fc/filesystem.hpp> | |
| #include <fc/exception/exception.hpp> | |
| #include <iostream> | |
| using fc::path; | |
| using fc::json; | |
| using fc::variant; |