| 
									
										
										
										
											2015-06-29 19:43:15 -04:00
										 |  |  | USING: concurrency.count-downs threads kernel tools.test ;
 | 
					
						
							|  |  |  | IN: concurrency.count-downs.tests` | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-03 12:39:59 -04:00
										 |  |  | { } [ 0 <count-down> await ] unit-test | 
					
						
							| 
									
										
										
										
											2015-06-29 19:43:15 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | [ 1 <count-down> dup count-down count-down ] must-fail | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-03 12:39:59 -04:00
										 |  |  | { } [ | 
					
						
							| 
									
										
										
										
											2015-06-29 19:43:15 -04:00
										 |  |  |     1 <count-down> | 
					
						
							|  |  |  |     3 <count-down> | 
					
						
							|  |  |  |     2dup [ await count-down ] 2curry "Master" spawn drop
 | 
					
						
							|  |  |  |     dup [ count-down ] curry "Slave" spawn drop
 | 
					
						
							|  |  |  |     dup [ count-down ] curry "Slave" spawn drop
 | 
					
						
							|  |  |  |     dup [ count-down ] curry "Slave" spawn drop
 | 
					
						
							|  |  |  |     drop await | 
					
						
							|  |  |  | ] unit-test |