Check-in [5d0a10221b]

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

Overview
Comment:Add more FDDD tests, clean up whitespace in tests, and fix bugs exposed in testing.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:5d0a10221b966d3cfc28c28d217a744132c6345d
User & Date: kbk 2014-08-03 00:17:57
Context
2014-08-03
00:18
Add more FDDD tests, clean up whitespace in tests, and fix bugs exposed in testing. check-in: c976bf220b user: kbk tags: trunk
00:17
Add more FDDD tests, clean up whitespace in tests, and fix bugs exposed in testing. check-in: 5d0a10221b user: kbk tags: trunk
2014-08-02
23:54
Add more FDDD tests, clean up whitespace in tests, and fix bugs exposed in testing. check-in: 95d5eacadf user: kbk tags: trunk
Changes

Changes to library/tclfddd.tcl.

916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
		lappend discards {*}[dict get $m_columns $col]
	    } else {
		dict unset want $col
	    }
	}
	if {[dict size $want] != 0} {
	    return -code error \
		-errorcode [list FDDD ProjectColumnMissing \
				{*}[dict keys $want]]\
		"columns missing from source relation: [dict keys $want]"
	}
	return [list [namespace which sys] project $dest \
		    [lsort -integer $discards] $source]
	return
    }

    # Method: relation







|
|
|







916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
		lappend discards {*}[dict get $m_columns $col]
	    } else {
		dict unset want $col
	    }
	}
	if {[dict size $want] != 0} {
	    return -code error \
		-errorcode [list FDDD ProjectColumnsMissing \
				[dict keys $want]]\
		"column(s) missing from source relation: [dict keys $want]"
	}
	return [list [namespace which sys] project $dest \
		    [lsort -integer $discards] $source]
	return
    }

    # Method: relation

Changes to tests/fddd.test.

655
656
657
658
659
660
661
662

663




































































































































664
665
666
667
668
669
670
671
        parent 0 child 0
        parent 0 child 1
        parent 2 child 4
        parent 2 child 5
    }
    -cleanup {db destroy}
}







































































































































cleanupTests
return

# Local Variables:
# mode: tcl
# c-basic-offset: 4
# indent-tabs-mode: nil
# End:








>

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>








655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
        parent 0 child 0
        parent 0 child 1
        parent 2 child 4
        parent 2 child 5
    }
    -cleanup {db destroy}
}

# fddd-13 - negate

test fddd-13.1 {negate} {*}{
    -setup makeDB
    -body {
        list [catch {
            db negate rubbish isParentOf
        } result] $result $::errorCode
    }
    -cleanup {db destroy}
    -result {1 {relation "rubbish" is not defined in this database} {FDDD RelationNotDefined rubbish}}
}

test fddd-13.2 {negate} {*}{
    -setup makeDB
    -body {
        list [catch {
            db negate result rubbish
        } result] $result $::errorCode
    }
    -cleanup {db destroy}
    -result {1 {relation "rubbish" is not defined in this database} {FDDD RelationNotDefined rubbish}}
}

test fddd-13.3 {negate} {*}{
    -setup makeDB
    -body {
        list [catch {
            db negate result troll
        } result] $result $::errorCode
    }
    -cleanup {db destroy}
    -result {1 {relations "result" and "troll" have different columns} {FDDD DifferentColumns result troll}}
}

test fddd-13.4 {negate} {*}{
    -setup makeDB
    -body {
        eval [db negate result isParentOf]
        set shouldHave {}
        for {set i 0} {$i < 8} {incr i} {
            for {set j 0} {$j < 8} {incr j} {
                dict set shouldhave $i:$j {}
            }
        }
        ::db enumerate d isParentOf {
            dict unset shouldhave [dict get $d parent]:[dict get $d child]
        }
        set doeshave {}
        ::db enumerate d result {
            dict set doeshave [dict get $d parent]:[dict get $d child] {}
        }
        set result {}
        if {[lsort [dict keys $doeshave]] ne [lsort [dict keys $shouldhave]]} {
            set result "Result is [lsort [dict keys $doeshave]]\nshould be [lsort [dict keys $shouldhave]]"
        }
        set result
    }
    -cleanup {db destroy}
    -result {}
}

# fddd-14 - profile

test fddd-14.1 {profile} {*}{
    -setup makeDB
    -body {
        list [catch {
            db profile rubbish
        } result] $result $::errorCode
    }
    -cleanup {db destroy}
    -result {1 {relation "rubbish" is not defined in this database} {FDDD RelationNotDefined rubbish}}
}

test fddd-14.2 {profile} {*}{
    -setup makeDB
    -body {
        db profile isParentOf
    }
    -result {parent 2 1 child 2 1 parent 1 2 child 1 1 parent 0 2 child 0 0}
}

# fddd-15 - project

test fddd-15.1 {project} {*}{
    -setup makeDB
    -body {
        list [catch {
            db project rubbish isParentOf
        } result] $result $::errorCode
    }
    -cleanup {db destroy}
    -result {1 {relation "rubbish" is not defined in this database} {FDDD RelationNotDefined rubbish}}
}

test fddd-15.2 {project} {*}{
    -setup makeDB
    -body {
        list [catch {
            db project result rubbish
        } result] $result $::errorCode
    }
    -cleanup {db destroy}
    -result {1 {relation "rubbish" is not defined in this database} {FDDD RelationNotDefined rubbish}}
}

test fddd-15.3 {project} {*}{
    -setup makeDB
    -body {
        list [catch {
            db project everything isParentOf
        } result] $result $::errorCode
    }
    -cleanup {db destroy}
    -result {1 {column(s) missing from source relation: bit xyz} {FDDD ProjectColumnsMissing {bit xyz}}}
}

test fddd-15.4 {project} {*}{
    -setup makeDB
    -body {
        eval [db project troll isParentOf]
        set r {}
        db enumerate d troll {
            dict set r [dict get $d parent] {}
        }
        lsort [dict keys $r]
    }
    -cleanup {db destroy}
    -result {0 1 2 3}
}



cleanupTests
return

# Local Variables:
# mode: tcl
# c-basic-offset: 4
# indent-tabs-mode: nil
# End: