| 
									
										
										
										
											2016-05-24 21:55:46 +02:00
										 |  |  | package assert | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import ( | 
					
						
							| 
									
										
										
										
											2016-08-20 20:55:45 +02:00
										 |  |  | 	"v2ray.com/core/common/serial" | 
					
						
							| 
									
										
										
										
											2016-05-24 21:55:46 +02:00
										 |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-11-27 21:39:09 +01:00
										 |  |  | func (v *Assert) Byte(value byte) *ByteSubject { | 
					
						
							| 
									
										
										
										
											2016-05-24 21:55:46 +02:00
										 |  |  | 	return &ByteSubject{ | 
					
						
							|  |  |  | 		Subject: Subject{ | 
					
						
							|  |  |  | 			disp: serial.ByteToHexString(value), | 
					
						
							| 
									
										
										
										
											2016-11-27 21:39:09 +01:00
										 |  |  | 			a:    v, | 
					
						
							| 
									
										
										
										
											2016-05-24 21:55:46 +02:00
										 |  |  | 		}, | 
					
						
							|  |  |  | 		value: value, | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | type ByteSubject struct { | 
					
						
							|  |  |  | 	Subject | 
					
						
							|  |  |  | 	value byte | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | func (subject *ByteSubject) Equals(expectation byte) { | 
					
						
							|  |  |  | 	if subject.value != expectation { | 
					
						
							|  |  |  | 		subject.Fail("is equal to", serial.ByteToHexString(expectation)) | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | func (subject *ByteSubject) GreaterThan(expectation byte) { | 
					
						
							|  |  |  | 	if subject.value <= expectation { | 
					
						
							|  |  |  | 		subject.Fail("is greater than", serial.ByteToHexString(expectation)) | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | func (subject *ByteSubject) LessThan(expectation byte) { | 
					
						
							|  |  |  | 	if subject.value >= expectation { | 
					
						
							|  |  |  | 		subject.Fail("is less than", serial.ByteToHexString(expectation)) | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } |