tclbdd

Check-in [b7045d44bb]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:test appquant
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:b7045d44bb3acb891829e3f6a9144ee7edb900df
User & Date: kbk 2013-12-11 03:01:05
Context
2013-12-11
13:27
add profiler check-in: bcd84fa263 user: kbk tags: trunk
03:01
test appquant check-in: b7045d44bb user: kbk tags: trunk
02:34
Added GarbageCollect for memory debugging Modified all tests to gc at the end and report # of nodes in use for leak checking. Added Tcl binding for ApplyAndQuantify Modified unset to take an arbitrary number of names. check-in: 7771be216c user: kbk tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to tests/bdd.test.

2387
2388
2389
2390
2391
2392
2393
2394


2395



































































































2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435

2436
2437
2438
2439
2440
2441
2442
2443
2444

2445
2446
2447
2448
2449
2450


2451
2452
2453
2454
2455
2456
2457
	    [sys unset x y z t u a b c d] \
	    [sys gc]
    }
    -result {1 {} 2}
    -cleanup {rename sys {}}
}

# FIXME tests for appquant






































































































test bdd-18.n {relational product} {*}{
    -setup {
	bdd::system create sys
	sys nthvar a 0; sys notnthvar !a 0
	sys nthvar b 1; sys notnthvar !b 1
	sys nthvar c 2; sys notnthvar !c 2
	sys nthvar d 3; sys notnthvar !d 3
	sys nthvar e 4; sys notnthvar !e 4
	sys nthvar f 5; sys notnthvar !f 5
	sys nthvar g 6; sys notnthvar !g 6
	sys nthvar h 7; sys notnthvar !h 7

	sys &3 p a !b !c
	sys & p p !d
	sys &3 expr1 p !e !f
	sys &3 expr2 p !g !h

	sys &3 p !a b !c
	sys & p p !d
	sys &3 term1 p !e f
	sys &3 term2 p !g h
	sys | expr1 expr1 term1
	sys | expr2 expr2 term2

	sys &3 p !a !b c
	sys & p p !d
	sys &3 term1 p e !f
	sys &3 term2 p g !h
	sys | expr1 expr1 term1
	sys | expr2 expr2 term2

	sys &3 p !a !b !c
	sys & p p d
	sys &3 term1 p e f
	sys &3 term2 p g h
	sys | expr1 expr1 term1
	sys | expr2 expr2 term2

	sys unset p term1 term2


	sys == result_sb e g
	sys == term f h
	sys & result_sb result_sb term
	sys unset term

    }
    -body {
	sys exists_& result_is {a b c d} expr1 expr2
	list [expr {[sys beadindex result_is] == [sys beadindex result_sb]}] \

	    [sys unset result_is result_sb expr1 expr2 \
		 a b c d e f g h !a !b !c !d !e !f !g !h] \
	    [sys gc]
    }
    -cleanup {rename sys {}}
    -result {1 {} 2}


}

test bdd-21.1 {eight queens} {*}{
    -setup {
	bdd::system create sys
	for {set i 0} {$i < 64} {incr i} {
	    sys nthvar v$i $i; sys notnthvar !v$i $i







|
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
>
|
<
<
|
|
|
|
|
|
>
|
|
|
|
|
|
>
>







2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538


2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
	    [sys unset x y z t u a b c d] \
	    [sys gc]
    }
    -result {1 {} 2}
    -cleanup {rename sys {}}
}

test bdd-18.1 {appquant - wrong # args} {*}{
    -setup {
	bdd::system create sys
    }
    -body {
	sys exists_&
    }
    -cleanup {
	rename sys {}
    }
    -result {wrong # args:*}
    -returnCodes error
    -match glob
}

test bdd-18.2 {appquant - bad lhs} {*}{
    -setup {
	bdd::system create sys
    }
    -body {
	list [catch {sys exists_& x {} garbage 1} result] $result $::errorCode
    }
    -cleanup {
	rename sys {}
    }
    -result \
	{1 {expression named "garbage" not found} {BDD ExprNotFound garbage}}
}

test bdd-18.3 {appquant - bad rhs} {*}{
    -setup {
	bdd::system create sys
    }
    -body {
	list [catch {sys exists_& x {} 1 garbage} result] $result $::errorCode
    }
    -cleanup {
	rename sys {}
    }
    -result \
	{1 {expression named "garbage" not found} {BDD ExprNotFound garbage}}
}

test bdd-18.4 {appquant - bad var list} {*}{
    -setup {
	bdd::system create sys
    }
    -body {
	list [catch {sys exists_& x \{ 1 1} result] $result $::errorCode
    }
    -cleanup {
	rename sys {}
    }
    -result \
	{1 {unmatched open brace in list} {TCL VALUE LIST BRACE}}
}

test bdd-18.5 {appquant - bad var} {*}{
    -setup {
	bdd::system create sys
    }
    -body {
	list [catch {sys exists_& x garbage 1 1} result] $result $::errorCode
    }
    -cleanup {
	rename sys {}
    }
    -result \
	{1 {expression named "garbage" not found} {BDD ExprNotFound garbage}}
}

test bdd-18.6 {appquant - bad var} {*}{
    -setup {
	bdd::system create sys
    }
    -body {
	list [catch {sys exists_& x 0 1 1} result] $result $::errorCode
    }
    -cleanup {
	rename sys {}
    }
    -result \
	{1 {0 is not a variable} {BDD NotVariable 0}}
}

test bdd-18.7 {appquant - do nothing to nothing} {*}{
    -setup {
	bdd::system create sys
    }
    -body {
	sys exists_& x {} 1 1
	list [sys beadindex x] [sys unset x] [sys gc]
    }
    -cleanup {
	rename sys {}
    }
    -result \
	{1 {} 2}
}

foreach q {exists forall} {
    foreach op {!= & < <= == > >= ^ nand nor |} {
	set combination ${q}_${op}
	test bdd-18.8-$combination {relational product} {*}{
	    -setup {
		bdd::system create sys
		sys nthvar a 0; sys notnthvar !a 0
		sys nthvar b 1; sys notnthvar !b 1
		sys nthvar c 2; sys notnthvar !c 2
		sys nthvar d 3; sys notnthvar !d 3
		sys nthvar e 4; sys notnthvar !e 4
		sys nthvar f 5; sys notnthvar !f 5
		sys nthvar g 6; sys notnthvar !g 6
		sys nthvar h 7; sys notnthvar !h 7
		
		sys &3 p a !b !c
		sys & p p !d
		sys &3 expr1 p !e !f
		sys &3 expr2 p !g !h
		
		sys &3 p !a b !c
		sys & p p !d
		sys &3 term1 p !e f
		sys &3 term2 p !g h
		sys | expr1 expr1 term1
		sys | expr2 expr2 term2
		
		sys &3 p !a !b c
		sys & p p !d
		sys &3 term1 p e !f
		sys &3 term2 p g !h
		sys | expr1 expr1 term1
		sys | expr2 expr2 term2
		
		sys &3 p !a !b !c
		sys & p p d
		sys &3 term1 p e f
		sys &3 term2 p g h
		sys | expr1 expr1 term1
		sys | expr2 expr2 term2
		
		sys unset p term1 term2
		
		sys $op opresult expr1 expr2
		sys $q result_sb {a b c d} opresult


		sys unset opresult
	    }
	    
	    -body {
		sys $combination result_is {a b c d} expr1 expr2
		list [expr {[sys beadindex result_is] \
				== [sys beadindex result_sb]}] \
		    [sys unset result_is result_sb expr1 expr2 \
			 a b c d e f g h !a !b !c !d !e !f !g !h] \
		    [sys gc]
	    }
	    -cleanup {rename sys {}}
	    -result {1 {} 2}
	}
    }
}

test bdd-21.1 {eight queens} {*}{
    -setup {
	bdd::system create sys
	for {set i 0} {$i < 64} {incr i} {
	    sys nthvar v$i $i; sys notnthvar !v$i $i