40
									
								
								tests/printf_test.aer
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								tests/printf_test.aer
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,40 @@ | |||||||
|  | class Main { | ||||||
|  | 	private $s = 'monkey'; | ||||||
|  | 	private $t = 'many monkeys'; | ||||||
|  | 	private $n =  43951789; | ||||||
|  | 	private $u = -43951789; | ||||||
|  | 	private $c = 65; | ||||||
|  |  | ||||||
|  | 	public function __construct() { | ||||||
|  | 		$this->testMonkey(); | ||||||
|  | 		$this->testNumbers(); | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	private function testMonkey() { | ||||||
|  | 		printf("[%s]\n", $this->s); | ||||||
|  | 		printf("[%10s]\n", $this->s); | ||||||
|  | 		printf("[%-10s]\n", $this->s); | ||||||
|  | 		printf("[%010s]\n", $this->s); | ||||||
|  | 		printf("[%'#10s]\n", $this->s); | ||||||
|  | 		printf("[%10.10s]\n", $this->t); | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | 	private function testNumbers() { | ||||||
|  | 		printf("%%b = '%b'\n", $this->n); | ||||||
|  | 		printf("%%c = '%c'\n", $this->c); | ||||||
|  | 		printf("%%d = '%d'\n", $this->n); | ||||||
|  | 		printf("%%e = '%e'\n", $this->n); | ||||||
|  | 		printf("%%u = '%u'\n", $this->n); | ||||||
|  | 		printf("%%u = '%u'\n", $this->u); | ||||||
|  | 		printf("%%f = '%f'\n", $this->n); | ||||||
|  | 		printf("%%o = '%o'\n", $this->n); | ||||||
|  | 		printf("%%s = '%s'\n", $this->n); | ||||||
|  | 		printf("%%x = '%x'\n", $this->n); | ||||||
|  | 		printf("%%X = '%X'\n", $this->n); | ||||||
|  | 		printf("%%+d = '%+d'\n", $this->n); | ||||||
|  | 		printf("%%+d = '%+d'\n", $this->u); | ||||||
|  | 	} | ||||||
|  |  | ||||||
|  | } | ||||||
|  |  | ||||||
|  | new Main(); | ||||||
							
								
								
									
										19
									
								
								tests/printf_test.exp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								tests/printf_test.exp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,19 @@ | |||||||
|  | [monkey] | ||||||
|  | [    monkey] | ||||||
|  | [monkey    ] | ||||||
|  | [0000monkey] | ||||||
|  | [####monkey] | ||||||
|  | [many monke] | ||||||
|  | %b = '10100111101010011010101101' | ||||||
|  | %c = 'A' | ||||||
|  | %d = '43951789' | ||||||
|  | %e = '4.395179e+07' | ||||||
|  | %u = '43951789' | ||||||
|  | %u = '43951789' | ||||||
|  | %f = '43951789.000000' | ||||||
|  | %o = '247523255' | ||||||
|  | %s = '43951789' | ||||||
|  | %x = '29ea6ad' | ||||||
|  | %X = '29EA6AD' | ||||||
|  | %+d = '+43951789' | ||||||
|  | %+d = '-43951789' | ||||||
							
								
								
									
										27
									
								
								tests/type_juggle.aer
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								tests/type_juggle.aer
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,27 @@ | |||||||
|  | class Main { | ||||||
|  |  | ||||||
|  | 	function __construct() { | ||||||
|  | 		$foo = '0'; | ||||||
|  | 		var_dump($foo); | ||||||
|  | 		$foo += 2; | ||||||
|  | 		var_dump($foo); | ||||||
|  | 		$foo = 1; | ||||||
|  | 		var_dump($foo); | ||||||
|  | 		$foo += 1.3; | ||||||
|  | 		var_dump($foo); | ||||||
|  | 		$foo = 5 + "10 Little Piggies"; | ||||||
|  | 		var_dump($foo); | ||||||
|  | 		$foo = 5 + 10; | ||||||
|  | 		var_dump($foo); | ||||||
|  | 		$foo = 'car'; | ||||||
|  | 		$foo[0] = 'b'; | ||||||
|  | 		var_dump($foo); | ||||||
|  | 		$foo = 10; | ||||||
|  | 		$foo = (bool) $foo; | ||||||
|  | 		var_dump($foo); | ||||||
|  | 		$foo = ''; | ||||||
|  | 		var_dump($foo); | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
|  | new Main(); | ||||||
							
								
								
									
										9
									
								
								tests/type_juggle.exp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								tests/type_juggle.exp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | |||||||
|  | string(1 '0') | ||||||
|  | string(2 '02') | ||||||
|  | int(1) | ||||||
|  | float(2.3) | ||||||
|  | string(18 '510 Little Piggies') | ||||||
|  | int(15) | ||||||
|  | string(3 'bar') | ||||||
|  | bool(TRUE) | ||||||
|  | string(0 '') | ||||||
		Reference in New Issue
	
	Block a user