mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	Fix padding.
This commit is contained in:
		
							parent
							
								
									ebf6d65d92
								
							
						
					
					
						commit
						4ba389e4fc
					
				
							
								
								
									
										46
									
								
								main.cpp
									
									
									
									
									
								
							
							
						
						
									
										46
									
								
								main.cpp
									
									
									
									
									
								
							| @ -21,8 +21,9 @@ | |||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| #include <boost/test/unit_test.hpp> | #include <boost/test/unit_test.hpp> | ||||||
| 
 | #include <boost/spirit/include/qi.hpp> | ||||||
| // TODO: utilise the shared testdata.
 | #include <boost/spirit/include/phoenix.hpp> | ||||||
|  | #include <boost/spirit/include/support_utree.hpp> | ||||||
| 
 | 
 | ||||||
| int trieTest(); | int trieTest(); | ||||||
| int rlpTest(); | int rlpTest(); | ||||||
| @ -33,11 +34,52 @@ int vmTest(); | |||||||
| int hexPrefixTest(); | int hexPrefixTest(); | ||||||
| int peerTest(int argc, char** argv); | int peerTest(int argc, char** argv); | ||||||
| 
 | 
 | ||||||
|  | #include <libethcore/Log.h> | ||||||
| #include <libethereum/BlockInfo.h> | #include <libethereum/BlockInfo.h> | ||||||
|  | using namespace std; | ||||||
| using namespace eth; | using namespace eth; | ||||||
|  | namespace qi = boost::spirit::qi; | ||||||
|  | namespace px = boost::phoenix; | ||||||
|  | namespace sp = boost::spirit; | ||||||
|  | 
 | ||||||
|  | template <typename Iterator> struct whitespace: qi::grammar<Iterator> | ||||||
|  | { | ||||||
|  | 	qi::rule<Iterator> start; | ||||||
|  | 	whitespace(): whitespace::base_type(start) | ||||||
|  | 	{ | ||||||
|  | 		start = *boost::spirit::standard::space;// | (';' >> *(boost::spirit::standard::char_ - qi::eol) >> qi::eol);
 | ||||||
|  | 	} | ||||||
|  | }; | ||||||
|  | 
 | ||||||
|  | ostream& operator<<(ostream& _out, sp::utree const& _this) | ||||||
|  | { | ||||||
|  | 	switch (_this.which()) | ||||||
|  | 	{ | ||||||
|  | 	case sp::utree_type::list_type: _out << "( "; for (auto const& i: _this) ::operator<<(_out, i) << " "; _out << ")"; break; | ||||||
|  | 	case sp::utree_type::int_type: _out << _this.get<int>(); break; | ||||||
|  | 	case sp::utree_type::string_type: _out << _this.get<string>(); break; | ||||||
|  | 	default: _out << "nil"; | ||||||
|  | 	} | ||||||
|  | 	return _out; | ||||||
|  | } | ||||||
| 
 | 
 | ||||||
| BOOST_AUTO_TEST_CASE(basic_tests) | BOOST_AUTO_TEST_CASE(basic_tests) | ||||||
| { | { | ||||||
|  | 	cnote << "Hello"; | ||||||
|  | /*
 | ||||||
|  | 	auto symbol = qi::lexeme[+(~qi::char_(std::string(" ();\"\x01-\x1f\x7f") + '\0'))]; | ||||||
|  | 	auto integer = qi::lexeme[ qi::no_case["#x"] >>  qi::hex] | qi::lexeme[ qi::no_case["#o"] >> qi::oct] | qi::lexeme[-qi::no_case["#d"] >> qi::int_]; | ||||||
|  | 	qi::rule<string::iterator, sp::utree()> atom = symbol | integer; | ||||||
|  | 	qi::rule<string::iterator, sp::utree()> list; | ||||||
|  | 	qi::rule<string::iterator, sp::utree()> element = atom | list; | ||||||
|  | 	list = '(' > *element > ')'; | ||||||
|  | 
 | ||||||
|  | 	string input = "(suicide (caller))"; | ||||||
|  | 	sp::utree out; | ||||||
|  | 
 | ||||||
|  | 	qi::parse(input.begin(), input.end(), element, out); | ||||||
|  | 	cnote << out; | ||||||
|  | */ | ||||||
| /*	RLPStream s;
 | /*	RLPStream s;
 | ||||||
| 	BlockInfo::genesis().fillStream(s, false); | 	BlockInfo::genesis().fillStream(s, false); | ||||||
| 	std::cout << RLP(s.out()) << std::endl; | 	std::cout << RLP(s.out()) << std::endl; | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user