* Improve snapshot testing Signed-off-by: Nick Cameron <nrc@ncameron.org> * A snapshot a day keeps the bugs away! 📷🐛 * A snapshot a day keeps the bugs away! 📷🐛 --------- Signed-off-by: Nick Cameron <nrc@ncameron.org> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
		
			
				
	
	
		
			23 lines
		
	
	
		
			397 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			23 lines
		
	
	
		
			397 B
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
---
 | 
						|
source: kcl-lib/src/simulation_tests.rs
 | 
						|
description: Result of unparsing computed_var.kcl
 | 
						|
---
 | 
						|
// This tests computed properties.
 | 
						|
 | 
						|
 | 
						|
arr = [0, 0, 0, 10]
 | 
						|
i = 3
 | 
						|
ten = arr[i]
 | 
						|
 | 
						|
assertEqual(ten, 10, 0.000001, "oops")
 | 
						|
 | 
						|
p = "foo"
 | 
						|
obj = { foo = 1, bar = 0 }
 | 
						|
one = obj[p]
 | 
						|
 | 
						|
assertEqual(one, 1, 0.0000001, "oops")
 | 
						|
 | 
						|
assertEqual(PI, 3, 0.2, "oops pi")
 | 
						|
x = cos(2 * PI)
 | 
						|
assertEqual(x, 1, 0.000001, "oops cos")
 |