added test cases
This commit is contained in:
		
							parent
							
								
									82f5332cf4
								
							
						
					
					
						commit
						1d3b4dd158
					
				
					 7 changed files with 160 additions and 7 deletions
				
			
		
							
								
								
									
										34
									
								
								doc/examples/json_pointer__to_string.cpp
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								doc/examples/json_pointer__to_string.cpp
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,34 @@ | |||
| #include <json.hpp> | ||||
| 
 | ||||
| using json = nlohmann::json; | ||||
| 
 | ||||
| int main() | ||||
| { | ||||
|     // different JSON Pointers
 | ||||
|     json::json_pointer ptr1(""); | ||||
|     json::json_pointer ptr2("/foo"); | ||||
|     json::json_pointer ptr3("/foo/0"); | ||||
|     json::json_pointer ptr4("/"); | ||||
|     json::json_pointer ptr5("/a~1b"); | ||||
|     json::json_pointer ptr6("/c%d"); | ||||
|     json::json_pointer ptr7("/e^f"); | ||||
|     json::json_pointer ptr8("/g|h"); | ||||
|     json::json_pointer ptr9("/i\\j"); | ||||
|     json::json_pointer ptr10("/k\"l"); | ||||
|     json::json_pointer ptr11("/ "); | ||||
|     json::json_pointer ptr12("/m~0n"); | ||||
| 
 | ||||
| 
 | ||||
|     std::cout << ptr1.to_string() << '\n' | ||||
|               << ptr2.to_string() << '\n' | ||||
|               << ptr3.to_string() << '\n' | ||||
|               << ptr4.to_string() << '\n' | ||||
|               << ptr5.to_string() << '\n' | ||||
|               << ptr6.to_string() << '\n' | ||||
|               << ptr7.to_string() << '\n' | ||||
|               << ptr8.to_string() << '\n' | ||||
|               << ptr9.to_string() << '\n' | ||||
|               << ptr10.to_string() << '\n' | ||||
|               << ptr11.to_string() << '\n' | ||||
|               << ptr12.to_string() << std::endl; | ||||
| } | ||||
							
								
								
									
										1
									
								
								doc/examples/json_pointer__to_string.link
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								doc/examples/json_pointer__to_string.link
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1 @@ | |||
| <a target="_blank" href="http://melpon.org/wandbox/permlink/O4FbKx0TbZioFhfU"><b>online</b></a> | ||||
							
								
								
									
										12
									
								
								doc/examples/json_pointer__to_string.output
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								doc/examples/json_pointer__to_string.output
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,12 @@ | |||
| 
 | ||||
| /foo | ||||
| /foo/0 | ||||
| / | ||||
| /a~1b | ||||
| /c%d | ||||
| /e^f | ||||
| /g|h | ||||
| /i\j | ||||
| /k"l | ||||
| /  | ||||
| /m~0n | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue