/ db / test /
/db/test/test.mk
1 # Copyright (C) 2012, 2013-2015 The Meme Factory, Inc. http://www.meme.com>/
2 #
3 # This file is part of GombeMI.
4 #
5 # GombeMI is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with GombeMI. If not, see <http://www.gnu.org/licenses/>.
17 #
18 # Regression test configuration
19 #
20 # Karl O. Pinc <kop@meme.com>
21 #
22 # What it will do:
23 # o Test anything you can write in SQL which requires only
24 # one database connection and produces repeatable output,
25 # repeatable with respect to an initial db state.
26 # o Filter sql output to remove unrepeatable components.
27 # o Eliminate redundancy in SQL files due to complex
28 # foreign key relationships and other integrity
29 # constraints and automate dependency resolution by
30 # sharing SQL files among multiple tests, and, given
31 # immediate prerequisites, figure out for itself which SQL
32 # files need to be invoked and the order in which to
33 # invoke them.
34 # o Account for tests which require transactions when
35 # resolving dependencies.
36 #
37 # What it won't do:
38 # o Any sort of test requiring multiple db connections, including
39 # deadlock testing etc.
40 # o Run concurrently within a single directory.
41 # o Allow spaces in the a test's (file) name.
42 #
43 # Tests designed to fail, run within transactions,
44 # must fail as the last thing they do. (*duh*)
45 #
46 # The reset SQL file is run before each test is started,
47 # when all tests are finished, and when the 'reset' target
48 # is supplied. It is not run after individual tests are run,
49 # shown, or saved. This file should empty
50 # the database and otherwise re-set it for the next test run.
51 # (Don't forget to reset the sequences with setval().)
52 # You use this to define the initial db state.
53 #
54 # Design notes:
55 # If you want
56 # multiple transactions then have your SQL issue it's own
57 # COMMITs and BEGINs to turn transactions off and on as
58 # desired.
59 #
60 # The following test names are reserved:
61 # 'begin' Must be used to begin a transaction.
62 # 'commit' Must be used to commit a transaction.
63 #
64 # To use:
65 #
66 # make test Runs entire test suite
67 # make test_<testname> Runs test <testname>
68 # make show_<testname> Display output of <testname>
69 # make save_<testname> Flags output of <testname> as successful
70 #
71 # To create a new test:
72 #
73 # * Write SQL script in test/sql/testname. This will usually involve
74 # inserting data.
75 # * Note dependencies below in prereq_testname. These are other files in
76 # test/sql/ that insert the data required to insert your new data.
77 # * To run the test within a transaction add the test to
78 # TRANSACTION_TESTS.
79 # * cd test; make GOMBEMI_DB=gobmemi_copy show_testname
80 # Make sure that the output is correct, then:
81 # * cd test; make GOMBEMI_DB=gombemi_copy save_testname
82 # This saves the output as correct output.
83 # * Add testname to TESTS, in correct place in order.
84 #
85 # If a test produces unrepeatable output:
86 # * Add a filter in the filters/ directory. This is an
87 # executable program. The file name should be the name of
88 # the test. (It may be a symlink.) The purpose of the
89 # filter program is to strip unrepeatable output from the
90 # sql results. The program takes one argument, the name
91 # of the test. It takes the result executing the test's
92 # sql on stdin. It's stdout is used as test output. If
93 # it returns a non-zero result code then the test exits
94 # with that result code and any output sent to stderr by
95 # the filter is used in the failure report. The program
96 # runs in the test directory. "dbgress filter" is a sample
97 # filter.
98 #
99 #
100 # When a test fails:
101 #
102 # * cd test; make GOMBEMI_DB=gombemi_copy show_testname
103 # Fix test/sql/testname, then, if necessary:
104 # * cd test; make GOMBEMI_DB=gombemi_copy save_testname
105 # This saves the output as correct output.
106 #
107
108 # Postgres user used to run the tests.
109 #ADMINUSER := kop
110
111 # List of tests to run by default.
112 # These are ordered.
113 TESTS := \
114 demography_support \
115 demography \
116 biography_data_deferred \
117 biography_data_null \
118 biography_data_entrybirth \
119 biography_data_departentry \
120 dad_male \
121 community_membership \
122 animid_ref_macro \
123 animid_immutable \
124 biography \
125 twins \
126 twins_reload \
127 chimpids_twins \
128 chimpids_req_row \
129 chimpids_autoinsert \
130 chimpids_autodel \
131 chimpids_uniq_bdi \
132 adoptions \
133 adoptions_twice \
134 adoptions_twice_twins \
135 adoptions_ub_ptooyoung \
136 adoptions_ub_ktooold \
137 adoptions_rev \
138 adoptions_ua_toosoon \
139 adoptions_ub_toosoon \
140 adoptions_ua_afterkid \
141 adoptions_ub_afterkid \
142 adoptions_ua_afterparent \
143 adoptions_ub_afterparent \
144 adoptions_ia_notmom \
145 adoptions_ub_notmom \
146 \
147 people \
148 followtypes \
149 followroles_error \
150 entry_follow_date_follows \
151 entry_follow_date_intervals \
152 entry_follow_date_sheets \
153 entry_follow_date_fieldfollows \
154 entrydate_null \
155 entrydate_null_follows \
156 entrydate_null_intervals \
157 entrydate_null_sheets \
158 entrydate_null_fieldfollows \
159 ff_uploaddate_entrydate \
160 sheets_errors \
161 sheets_deletes_fieldfollows \
162 intervals \
163 intervals_onesheet \
164 intervals_badtime \
165 intervals_timeearly \
166 intervals_timelate \
167 intervals_abandonsheet \
168 fieldfollows_collector \
169 sheets_collector \
170 intervals_collector \
171 follows_collector \
172 follows_nomom \
173 followparts_twice \
174 followparts_deletemom \
175 biography_beforefollow \
176 biography_afterfollow \
177 followparts_beforefollow \
178 followparts_afterfollow \
179 follows_tooearly \
180 follows_toolate \
181 followparts_sib \
182 followparts_sibrev \
183 biography_i_sibrev \
184 biography_u_sibrev \
185 followparts_twins \
186 followparts_badtwin \
187 biography_badtwin \
188 badtwinrole_fp \
189 badtwinrole_twins \
190 follows_dup \
191 followparts_dup \
192 followparts_if_badmom \
193 followparts_ub_badmom \
194 followparts_amom \
195 followparts_amom_nomom \
196 followparts_amom_ktooold \
197 followparts_ub_ktooold \
198 followparts_uf_ktooold \
199 followparts_if_badadate \
200 followparts_if_badadate2 \
201 followparts_ub_rmmom \
202 followparts_replace_bio \
203 followparts_ua_badadate \
204 followparts_da_noadopt \
205 follows_intervals_f \
206 follows_intervals_i \
207 \
208 gcstatus \
209 gcstatus_raw_groups_i \
210 gcstatus_raw_groups_d \
211 gcstatus_null_sheets \
212 gcstatus_nonnull_sheets \
213 gcstatus_null_fieldfollows \
214 gcstatus_nonnull_fieldfollows \
215 \
216 groupinfants \
217 groups_onintervals_groups \
218 grouplots_vacuum_analyze \
219 groups_onintervals_intervals_u \
220 groups_onintervals_intervals_d \
221 groups_a_n_s_groupmembers_e \
222 groups_a_n_s_groupmembers_d \
223 groups_a_n_s_biography_e \
224 groups_a_n_s_biography_d \
225 groups_a_n_s_intervals_e \
226 groups_a_n_s_intervals_d \
227 groups_a_n_s_follows_e \
228 groups_a_n_s_follows_d \
229 groups_momkid_900 \
230 groups_nomom_intervals \
231 groups_nomom_followparts \
232 groups_nomom_groupmembers_u \
233 groups_nomom_groupmembers_d \
234 swelling \
235 swelling_notmale \
236 swelling_notmale_biography \
237 swelling_minage \
238 swelling_nma_biography \
239 swelling_nma_groupmembers\
240 swelling_nma_intervals \
241 swelling_nma_follows \
242 \
243 distanceparts_lots \
244 distanceparts_twice \
245 not2dparts_d \
246 not2dparts_dpi \
247 not2dparts_dpd \
248 distoffp_dp \
249 distoffp_fp \
250 distoffp_intervals \
251 distoffp_distances \
252 distonfp_intervals \
253 distonfp_distances \
254 distonfp_dp \
255 distonfp_fpd \
256 distonfp_fpu \
257 disttwice_dp \
258 disttwice_d \
259 \
260 dp_in_gm_dp \
261 dp_in_gm_d \
262 dp_in_gm_i \
263 dp_in_gm_gm_d \
264 dp_in_gm_gm_u \
265 dp_distunk_is_true \
266 \
267 behaviors \
268 behaviors_exclude_restricted \
269 behaviors_both_directions_null \
270 behaviors_both_directions_non_null \
271 behaviors_baboon_null \
272 behaviors_baboon_non_null \
273 null_iff_not_true_nf \
274 null_iff_not_true_nt \
275 null_iff_not_true_tf \
276 null_iff_not_true_tt \
277 parts_lots \
278 other_mom_grooming \
279 other_grooming_infant \
280 infant_grooming_other \
281 infant_play_other_participant \
282 sib_grooms_infant \
283 sib_play_other_participant \
284 sib_eats \
285 other_grooming_sib \
286 sib_grooming_other \
287 mom_grooming_baboon \
288 parts_uniq_ind \
289 parts_tooearly \
290 parts_tooearly_b \
291 parts_tooearly_f \
292 parts_toolate \
293 parts_toolate_b \
294 parts_toolate_f \
295 event_unique_e \
296 event_unique_p \
297 eats0 \
298 eats1 \
299 eats0_d \
300 eats2 \
301 eats_rides \
302 rides0 \
303 rides1 \
304 rides0_d \
305 rides2 \
306 rides_eats \
307 fishing1 \
308 fishing_fishable_fp_u \
309 fishing_fishable_fp_i \
310 fishing_fishable_fk_u \
311 fishing_fishable_fk_i \
312 resting \
313 plays \
314 vocs \
315 \
316 pif_u_parts \
317 pif_d_parts \
318 pif_events \
319 pif_intervals \
320 pif_followparts_u \
321 pif_followparts_d \
322 \
323 behaviors_mom_actor \
324 behaviors_mom_actee \
325 behaviors_mom_participant \
326 behaviors_mom_self \
327 behaviors_mom_nf_actor \
328 behaviors_mom_nf_actee \
329 behaviors_mom_nf_participant \
330 behaviors_infant_actor \
331 behaviors_infant_actee \
332 behaviors_infant_participant \
333 behaviors_infant_self \
334 behaviors_infant_nf_actor \
335 behaviors_infant_nf_actee \
336 behaviors_infant_nf_participant \
337 behaviors_sib_actor \
338 behaviors_sib_actee \
339 behaviors_sib_participant \
340 behaviors_sib_self \
341 behaviors_sib_nf_actor \
342 behaviors_sib_nf_actee \
343 behaviors_sib_nf_participant \
344 behaviors_mom_baboon \
345 \
346 parts_mom_actor \
347 parts_mom_actee \
348 parts_mom_participant \
349 parts_mom_self \
350 parts_mom_nf_actor \
351 parts_mom_nf_actee \
352 \
353 events_mom_actor \
354 events_mom_actee \
355 events_mom_participant \
356 events_mom_self \
357 events_mom_nf_actor \
358 events_mom_nf_actee \
359 events_mom_nf_participant \
360 \
361 behaviors_position_true \
362 behaviors_position_false \
363 events_position \
364 events_no_parts \
365 events_3_parts \
366 events_2_parts_baboon \
367 parts_3_parts \
368 parts_1_part \
369 parts_1_part_baboon \
370 parts_2_self \
371 parts_self_baboon \
372 events_self_baboon \
373 parts_actor_actor \
374 parts_actor_actor_d \
375 parts_actee_actee \
376 parts_participant_participant \
377 parts_participant_baboon \
378 \
379 self_participant_play \
380 behaviors_both_directions \
381 parts_both_directions \
382 events_both_directions \
383 \
384 behaviors_restricted \
385 behaviors_exclusive \
386 behaviors_mom_restricted \
387 behaviors_mom_exclusive \
388 behaviors_er_uncertain \
389 behaviors_er_actee \
390 parts_restricted \
391 parts_exclusive \
392 parts_mom_restricted \
393 parts_mom_exclusive \
394 parts_er_uncertain \
395 parts_er_actee \
396 events_restricted \
397 events_exclusive \
398 events_mom_restricted \
399 events_mom_exclusive \
400 events_er_uncertain \
401 events_er_actee \
402 \
403 ff_interval \
404 ff_insert_out \
405 ff_interval1 \
406 ff_insert1_out \
407 ffu_date \
408 ffu_date_out \
409 ffu_mom \
410 ffu_mom_out \
411 ffu_newsib \
412 ffu_newsib_out \
413 ffud \
414 ffud_out \
415 ff_delete \
416 ff_delete_out \
417 ff_twins_out \
418 fi_out \
419 fi_i_followid \
420 fi_i_dmi \
421 fi_i_sheetid \
422 fi_i_page \
423 fi_i_ffid \
424 fi_i_collector \
425 fi_u_time \
426 fi_d \
427 fi_error \
428 fe_out \
429 fe_i_intid \
430 fe_i_dmit \
431 fe_i_ft \
432 fe_i_lots \
433 fe_u_behavior \
434 fe_u_chimpid \
435 fe_u_oldtonew \
436 fe_d \
437 de_out \
438 de_i_intid \
439 de_i_eats \
440 de_i_eats2 \
441 de_i_fished \
442 de_i_plays \
443 de_i_plays2 \
444 de_i_rests \
445 de_i_rides \
446 de_i_vocs \
447 de_i_vocs2 \
448 de_i_lots \
449 de_u_behavior \
450 de_u_vocs \
451 de_u_vocs2 \
452 de_u_eats \
453 de_u_eats2 \
454 de_u_plays \
455 de_u_plays2 \
456 de_u_rests \
457 de_u_rides \
458 de_u_eats_i \
459 de_u_fished_i \
460 de_u_plays_i \
461 de_u_rests_i \
462 de_u_rides_i \
463 de_u_vocs_i \
464 de_d \
465 fd_out \
466 fd_i_intid \
467 fd_i_dmit \
468 fd_i_ft \
469 fd_i_ft_mom_sib \
470 fd_i_lots \
471 fd_u_distance \
472 fd_u_chimpid \
473 fd_u_oldtonew \
474 fd_d \
475 \
476 iqtypes \
477 iq_i \
478 iq_i_notempty \
479 iq_i_nospace \
480 iq_u_iqname \
481 iq_u_last_early \
482 iw_i \
483 iw_u_last_early \
484 iw_u_resolved_early \
485 iw_u_deferred_early \
486 iw_u_resolve \
487 iq_u_make_error \
488 iq_u_resolve_errors \
489 iw_u_resolve_errors \
490 riq_badarg \
491 riq_bad_iqname \
492 riq_bad_squery \
493 riq_1_results \
494 riq_2_results \
495 riq_every_rtimestamp \
496 riq_every_stimestamp \
497 riq_one_stimestamp \
498 riq_resolved \
499 riq_future \
500 riq_past \
501 riq_no_problem
502
503 # Tests that require transactions.
504 # When tests which require a transaction are dependencies,
505 # the transaction is started when the dependency is fulfilled
506 # but not before. I.e. Not necessarily before _any_ data is loaded.
507 #
508 # Transactions are catagorized into two sorts, those that raise
509 # errors and those that don't. Transactions which raise errors
510 # have the COMMIT included in their test output. This allows
511 # capture of errors raised by DEFERREABLE INITIALLY DEFERRED
512 # constraints and CONSTRAINT triggers.
513 ERROR_FREE_TRANSACTIONS := \
514 twins_reload \
515 fieldfollows1 \
516 fieldfollows2 \
517 fieldfollows3 \
518 fieldfollows4 \
519 fieldfollows5 \
520 fieldfollows6 \
521 fieldfollows7 \
522 fieldfollows1_late_entrydate \
523 fieldfollows2_null_entrydate \
524 fieldfollows1_gcstatus \
525 sheets \
526 sheets_gcstatus \
527 sheets_deletes_fieldfollows \
528 sheets_second \
529 sheets_third \
530 sheets_fourth \
531 sheets_fifth \
532 sheets_sixth \
533 intervals \
534 follows1_data \
535 follows2_data \
536 follows3_data \
537 follows4_data \
538 follows5_data \
539 follows6_data \
540 followparts2 \
541 followparts5 \
542 followparts6 \
543 followparts_sib \
544 followparts_sib_noi \
545 followparts_twins \
546 followparts_amom \
547 followparts_amom_noi \
548 followparts_amom_nomom \
549 followparts_replace_bio \
550 intervals_first_follow \
551 intervals_third_follow \
552 intervals_fourth_follow \
553 intervals_lots_follow1 \
554 intervals_lots_follow2 \
555 intervals_lots_day2 \
556 intervals_lots \
557 intervals_sixth_follow \
558 intervals_3rd_late \
559 entrydate_null \
560 follows1_after_null_entrydate \
561 follows2_after_null_entrydate \
562 gcstatus \
563 raw_groups1 \
564 raw_groupmembers1 \
565 groups \
566 groups_onemom \
567 groups_onemom_900 \
568 groups_onemom902 \
569 groups_momkid_900 \
570 groups_momkid902 \
571 groupmoms_day1 \
572 groupmoms_day2 \
573 groupmoms \
574 groupinfants_day1 \
575 groupinfants_day2 \
576 groupinfants \
577 grouplots \
578 grouplots_vacuum_analyze \
579 swelling \
580 swelling_minage \
581 distanceparts_lots \
582 distance_one \
583 ninethirty_sheet \
584 distancepart_extra \
585 follow3_twin \
586 distanceparts_one \
587 distancepart_extra2 \
588 distanceparts900 \
589 parts_lots \
590 parts_lots_dad_mom_grooming \
591 parts_lots_i_selfplay \
592 parts_lots_infant_eating \
593 parts_lots_infant_mom_grooming \
594 parts_lots_infant_mom_play \
595 parts_lots_infant_nursing \
596 parts_lots_infant_other \
597 parts_lots_infant_resting \
598 parts_lots_infant_self_play \
599 parts_lots_infant_sib_grooming \
600 parts_lots_mom_baboon_grooming \
601 parts_lots_mom_dad_grooming \
602 parts_lots_mom_eating \
603 parts_lots_mom_infant_grooming \
604 parts_lots_mom_ma5_play_nondirected \
605 parts_lots_mom_other \
606 parts_lots_mom_resting \
607 parts_lots_mom_unknown_grooming \
608 parts_lots_mom_unknown_grooming2 \
609 parts_lots_after_noc_sheet \
610 other_mom_grooming \
611 other_grooming_infant \
612 infant_grooming_other \
613 infant_play_other_participant \
614 sib_grooms_infant \
615 sib_play_other_participant \
616 sib_eats \
617 other_grooming_sib \
618 sib_grooming_other \
619 mom_grooming_baboon \
620 eats \
621 eats1 \
622 eats2 \
623 rides \
624 rides1 \
625 fishing \
626 fishing1 \
627 resting \
628 plays \
629 vocs \
630 nineoclock_sheet \
631 parts_1_part_baboon \
632 parts_participant_baboon \
633 behaviors_er_uncertain \
634 behaviors_er_actee \
635 parts_er_uncertain \
636 parts_er_actee \
637 events_er_uncertain \
638 \
639 ff_insert \
640 ff_insert_out \
641 ff_insert1 \
642 ff_insert1_out \
643 ffu_date \
644 ffu_mom \
645 ffu_newsib \
646 ffud \
647 ff_delete \
648 fd_i_lots
649
650
651
652 ERROR_RAISING_TRANSACTIONS := \
653 dad_male \
654 adoptions_ub_ptooyoung \
655 adoptions_ub_ktooold \
656 adoptions_ua_toosoon \
657 adoptions_ub_toosoon \
658 adoptions_ua_afterkid \
659 adoptions_ub_afterkid \
660 adoptions_ua_afterparent \
661 adoptions_ub_afterparent \
662 adoptions_ia_notmom \
663 adoptions_ub_notmom \
664 \
665 ff_uploaddate_entrydate \
666 fieldfollows_needs_sheets \
667 sheets_errors \
668 intervals_onesheet \
669 intervals_badtime \
670 intervals_timeearly \
671 intervals_timelate \
672 intervals_abandonsheet \
673 fieldfollows_collector \
674 sheets_collector \
675 intervals_collector \
676 follows_collector \
677 entry_follow_date_follows \
678 entry_follow_date_intervals \
679 entry_follow_date_sheets \
680 entry_follow_date_fieldfollows \
681 entrydate_null_follows \
682 entrydate_null_intervals \
683 entrydate_null_sheets \
684 entrydate_null_fieldfollows \
685 follows_nomom \
686 followparts_twice \
687 followparts_deletemom \
688 biography_beforefollow \
689 biography_afterfollow \
690 followparts_beforefollow \
691 followparts_afterfollow \
692 follows_tooearly \
693 follows_toolate \
694 followparts_sibrev \
695 biography_i_sibrev \
696 biography_u_sibrev \
697 followparts_badtwin \
698 biography_badtwin \
699 badtwinrole_fp \
700 badtwinrole_twins \
701 follows_dup \
702 followparts_dup \
703 followparts_amom_ktooold \
704 followparts_ub_ktooold \
705 followparts_uf_ktooold \
706 followparts_if_badmom \
707 followparts_ub_badmom \
708 followparts_if_badadate \
709 followparts_if_badadate2 \
710 followparts_ub_rmmom \
711 followparts_ua_badadate \
712 followparts_da_noadopt \
713 follows_intervals_f \
714 follows_intervals_i \
715 \
716 gcstatus_raw_groups_i \
717 gcstatus_raw_groups_d \
718 gcstatus_null_sheets \
719 gcstatus_nonnull_sheets \
720 gcstatus_null_fieldfollows \
721 gcstatus_nonnull_fieldfollows \
722 \
723 groups_onintervals_intervals_u \
724 groups_onintervals_intervals_d \
725 groups_a_n_s_groupmembers_e \
726 groups_a_n_s_groupmembers_d \
727 groups_a_n_s_biography_e \
728 groups_a_n_s_biography_d \
729 groups_a_n_s_intervals_e \
730 groups_a_n_s_intervals_d \
731 groups_a_n_s_follows_e \
732 groups_a_n_s_follows_d \
733 groups_nomom_intervals \
734 groups_nomom_followparts \
735 groups_nomom_groupmembers_u \
736 groups_nomom_groupmembers_d \
737 swelling_notmale \
738 swelling_notmale_biography \
739 swelling_nma_biography \
740 swelling_nma_groupmembers \
741 swelling_nma_intervals \
742 swelling_nma_follows \
743 \
744 distanceparts_twice \
745 not2dparts_d \
746 not2dparts_dpi \
747 not2dparts_dpd \
748 distoffp_dp \
749 distoffp_fp \
750 distoffp_intervals \
751 distoffp_distances \
752 distonfp_intervals \
753 distonfp_distances \
754 distonfp_dp \
755 distonfp_fpd \
756 distonfp_fpu \
757 disttwice_dp \
758 disttwice_d \
759 \
760 dp_in_gm_dp \
761 dp_in_gm_d \
762 dp_in_gm_i \
763 dp_in_gm_gm_d \
764 dp_in_gm_gm_u \
765 dp_distunk_is_true \
766 \
767 parts_uniq_ind \
768 parts_tooearly \
769 parts_tooearly_b \
770 parts_tooearly_f \
771 parts_toolate \
772 parts_toolate_b \
773 parts_toolate_f \
774 event_unique_e \
775 event_unique_p \
776 eats0 \
777 eats0_d \
778 eats_rides \
779 rides0 \
780 rides0_d \
781 rides2 \
782 rides_eats \
783 fishing_fishable_fp_u \
784 fishing_fishable_fp_i \
785 fishing_fishable_fk_u \
786 fishing_fishable_fk_i \
787 pif_u_parts \
788 pif_d_parts \
789 pif_events \
790 pif_intervals \
791 pif_followparts_u \
792 pif_followparts_d \
793 \
794 behaviors_mom_actor \
795 behaviors_mom_actee \
796 behaviors_mom_participant \
797 behaviors_mom_self \
798 behaviors_mom_nf_actor \
799 behaviors_mom_nf_actee \
800 behaviors_mom_nf_participant \
801 behaviors_infant_actor \
802 behaviors_infant_actee \
803 behaviors_infant_participant \
804 behaviors_infant_self \
805 behaviors_infant_nf_actor \
806 behaviors_infant_nf_actee \
807 behaviors_infant_nf_participant \
808 behaviors_sib_actor \
809 behaviors_sib_actee \
810 behaviors_sib_participant \
811 behaviors_sib_self \
812 behaviors_sib_nf_actor \
813 behaviors_sib_nf_actee \
814 behaviors_sib_nf_participant \
815 behaviors_mom_baboon \
816 \
817 parts_mom_actor \
818 parts_mom_actee \
819 parts_mom_participant \
820 parts_mom_self \
821 parts_mom_nf_actor \
822 parts_mom_nf_actee \
823 \
824 events_mom_actor \
825 events_mom_actee \
826 events_mom_participant \
827 events_mom_self \
828 events_mom_nf_actor \
829 events_mom_nf_actee \
830 events_mom_nf_participant \
831 \
832 behaviors_position_true \
833 behaviors_position_false \
834 events_position \
835 events_no_parts \
836 events_3_parts \
837 events_2_parts_baboon \
838 parts_3_parts \
839 parts_1_part \
840 parts_2_self \
841 parts_self_baboon \
842 events_self_baboon \
843 parts_actor_actor \
844 parts_actor_actor_d \
845 parts_actee_actee \
846 parts_participant_participant \
847 \
848 self_participant_play \
849 behaviors_both_directions \
850 parts_both_directions \
851 events_both_directions \
852 \
853 behaviors_restricted \
854 behaviors_exclusive \
855 behaviors_mom_restricted \
856 behaviors_mom_exclusive \
857 parts_restricted \
858 parts_exclusive \
859 parts_mom_restricted \
860 parts_mom_exclusive \
861 events_restricted \
862 events_exclusive \
863 events_mom_restricted \
864 events_mom_exclusive \
865 events_er_actee \
866 \
867 fi_error
868
869
870 # Test prerequisites. (These are immediate prerequisites, you need not
871 # chase back through the dependencies.)
872 # It is optional for a test to have prerequsites.
873 # The names of these must have 'prereq_' and then the name of
874 # the test.
875
876 # Tip: If the prerequsite is not a test itself and is
877 # shared by multiple tests do not have the sql
878 # select generated keys.
879
880 # Load basic biography_data: MOM, KID, DAD, MGE
881 prereq_demography := demography_support
882 # Create an unknown individual: UNK
883 prereq_unk := demography_support
884 # Try to make a female a dad.
885 prereq_dad_male := demography female4
886 prereq_sib := demography
887 # Add a second sibling (animid='SB2', mom = 'MOM') not as old as SIB
888 prereq_sib2 := demography
889 prereq_biography_data_deferred := demography
890 prereq_biography_data_null := demography
891 # Needs filter (import_datetime)
892 prereq_biography_data_entrybirth := demography_support
893 # Needs filter (import_datetime)
894 prereq_biography_data_departentry := demography_support
895 prereq_community_membership := demography
896 # Needs filter (referenced table name when deleting)
897 prereq_animid_ref_macro := community_membership
898 prereq_animid_immutable := demography
899 prereq_biography := demography_support
900 # Make KID into a twin (TWN)
901 prereq_twins := demography
902 prereq_twins_reload := twins
903 # Make KID 5 years old.
904 # (This is likely a bad idea, but works for now.)
905 prereq_kid5 := demography
906 # Give twins some virtual identifiers.
907 prereq_chimpids_twins := twins
908 # Chimpids must have a row with chimpid=animid for each biography_data row:
909 # delete of chimpids.
910 prereq_chimpids_req_row := demography
911 # Chimpids rows are automatically created upon insertion of biography_data.
912 prereq_chimpids_autoinsert := demography
913 # Chimpids rows are automatically deleted upon deletion of biography_data.
914 prereq_chimpids_autodel := demography
915 # Chimpid values cannot be used as biography_data.animid values:
916 # insert of biography_data.
917 prereq_chimpids_uniq_bdi := chimpids_twins
918 prereq_male3 := demography_support
919 prereq_male4 := demography_support
920 prereq_male5 := demography_support
921 # A male who's gone 2000-01-01
922 prereq_male6 := demography_support
923 # A young (birth 2004-01-01, gone 2012-01-01) male, with no mom
924 prereq_male7 := demography_support
925 # A young (birth 2004-01-01, gone 2012-01-01) male, with mom of FE4
926 prereq_male8 := demography_support female4
927 # A young (birth 2005-01-01, gone 2012-01-01) male, with mom of FE4
928 prereq_male9 := demography_support female4
929 # An old male (birth 1994-01-01, gone 2012-01-01) male, with mom of FE4
930 prereq_male10 := demography_support female4
931 # A young male (birth 2003-01-01, gone 2012-01-01) male, with mom of FE5
932 prereq_male11 := demography_support female5
933 prereq_female1 := demography_support
934 prereq_female2 := demography_support
935 prereq_female3 := demography_support
936 prereq_female4 := demography_support
937 prereq_female5 := demography_support
938 prereq_female6 := demography_support female4
939 # Add one adoption: MA3 adopts KI2
940 prereq_adoptions := adoptions_prereqs
941 # Cannot be adopted twice by the same parent: same chimpid
942 prereq_adoptions_twice := adoptions
943 # Cannot be adopted twice by the same parent: different chimpid
944 prereq_adoptions_twice_twins := adoptions4 chimpids_twins
945 # Add a second adoptions: DAD adopts MA3
946 prereq_adoptions2 := male3 demography adoptions
947 # Add a third adoption: DAD adopts MA4
948 prereq_adoptions3 := demography male4 adoptions2
949 # Add a fourth adoption: DAD adopts KID
950 prereq_adoptions4 := demography
951 prereq_adoptions_ub_ptooyoung := adoptions3
952 prereq_adoptions_ub_ktooold := adoptions3
953 # Adopting parent must be older than adopted kid: insert of adoptions
954 prereq_adoptions_rev := adoptions_prereqs
955 # Date of adoption cannot be before birth of adopted individual:
956 # update adoptions.adate
957 prereq_adoptions_ua_toosoon := adoptions3
958 # Date of adoption cannot be before birth of adopted individual:
959 # update biography_data.birthdate
960 prereq_adoptions_ub_toosoon := adoptions3
961 # Date of adoption cannot be after departdate of adopted individual:
962 # update adoptions.adate
963 prereq_adoptions_ua_afterkid := adoptions3
964 # Date of adoption cannot be after departdate of adopted individual:
965 # update biography_data.departdate
966 prereq_adoptions_ub_afterkid := adoptions3
967 # Date of adoption cannot be after departdate of adoptive parent:
968 # update adoptions.adate
969 prereq_adoptions_ua_afterparent := adoptions3
970 prereq_adoptions_ub_afterparent := adoptions3
971 # A mother cannot adopt her own child: insert into adoptions
972 prereq_adoptions_ia_notmom := demography
973 # A mother cannot adopt her own child: update biography_data
974 prereq_adoptions_ub_notmom := demography family2
975
976 # A second family
977 prereq_family2 := demography_support
978
979 # Add an older male sibling to family2.
980 prereq_si2 := family2
981
982 prereq_followrole_twin := followroles
983 # Follow 1 (followid = 1) 2004-06-01 (usually to go with MOM and KID)
984 prereq_follows1_data := follow_prereqs
985 # Follow 2 (followid = 2) 2004-06-01 (usually with MO2 and KI2)
986 prereq_follows2_data := follows1_data
987 # Follow number 3, without having to have follow 1 or 2.
988 # (followid = 3) 2004-06-02 (usually with MOM and KID)
989 prereq_follows3_data := follow_prereqs
990 # Follow number 5, a 20 year old follow, without having to have follows 1-4.
991 # Date 1993-04-01. followid = 5 Usually with FE4 (mom) and FE6 (infant).
992 prereq_follows5_data := follow_prereqs
993 # Follow number 6, another contemporary follow (with FE4 (mom) and FE6 (kid))
994 # (followid = 6) Date 2004-06-03
995 prereq_follows6_data := follow_prereqs
996 prereq_follows := follows2_data followparts
997
998 # Date of the follow cannot be after the data entry date: update of follows.
999 # Needs filter (time)
1000 prereq_entry_follow_date_follows := intervals_first_follow followparts1
1001 # Date of the follow cannot be after the data entry date: update of intervals.
1002 # Use first and third follows, make the entrydate of the first the same as the
1003 # followdate and then move an interval from the 1st to the 3rd follow.
1004 # Needs filter (time)
1005 prereq_entry_follow_date_intervals := intervals_3rd_late followparts13
1006 # Date of the follow cannot be after data entry daet: update of sheets.
1007 # Use first follow and move the sheet to a different fieldfollow.
1008 # (Delete the unused fieldfollow so it's not left without a sheet.)
1009 prereq_entry_follow_date_sheets := intervals_first_follow followparts1 \
1010 fieldfollows7
1011 # Date of the follow cannot be after the data entry date:
1012 # update of fieldfollows.
1013 prereq_entry_follow_date_fieldfollows := intervals_first_follow followparts1
1014
1015 # Date of data entry cannot be null after gmi_max_null_entrydate
1016 #
1017 # Test entrydate _can_ be null before the max date.
1018 prereq_entrydate_null := intervals_first_follow followparts1
1019 # Setup follow 1 so that it's date is after gmi_max_null_entrydate.
1020 prereq_follows1_after_null_entrydate := follows1_data \
1021 fieldfollows1_late_entrydate
1022 # Setup follow 2 so that it's date is after gmi_max_null_entrydate.
1023 prereq_follows2_after_null_entrydate := follows2_data
1024 # Setup fieldfollow 1 so that it has a late entrydate to match
1025 # the follows.date of follows1_after_null_entrydate.
1026 prereq_fieldfollows1_late_entrydate := fieldfollows1
1027 # Setup fieldfollow 2 so it has a null entrydate.
1028 prereq_fieldfollows2_null_entrydate := fieldfollows2
1029 # Date of data entry cannot be null after the max date: update of follows
1030 # Needs filter (time)
1031 prereq_entrydate_null_follows := entrydate_null
1032 # Date of data entry cannot be null after the max date: update of intervals
1033 # Have follow 1 with intervals and a null entrydate, follow 2 with
1034 # no intervals and a date after gmi_max_null_entrydate. Move intervals
1035 # from follow 1 to follow 2.
1036 # Needs filter (intid, time)
1037 prereq_entrydate_null_intervals := entrydate_null follows2_after_null_entrydate
1038 # Date of data entry cannot be null after the max date: update of sheets
1039 # Change follow1 to be after max_null_entrydate. Move the sheet
1040 # to a fieldfollows row with a null entrydate.
1041 prereq_entrydate_null_sheets := intervals_first_follow followparts1 \
1042 follows1_after_null_entrydate sheets_second \
1043 fieldfollows2_null_entrydate
1044 # Date of data entry cannot be null after the max date: update of fieldfollows
1045 prereq_entrydate_null_fieldfollows := follows1_after_null_entrydate \
1046 intervals_first_follow followparts1
1047
1048 # Insert first field follow to be used with first follow: ffid = 1
1049 prereq_fieldfollows1 := followtypes people
1050 # A fieldfollow identical to fieldfollows1 but with a non-null gcstatus.
1051 prereq_fieldfollows1_gcstatus := followtypes people gcstatuses
1052 # Insert a fieldfollows and get error because there's no related sheets row.
1053 prereq_fieldfollows_needs_sheets := followtypes people
1054 # Insert a fieldfollow and get an error because the upload date is
1055 # before the entry date.
1056 prereq_ff_uploaddate_entrydate := followtypes people gcstatuses
1057 # Insert second field follow to be used with 2nd follow: ffid = 2
1058 # (And in conjunction with the first follow.)
1059 # (Has a different collector since follow 2 is the same date as follow 1.)
1060 prereq_fieldfollows2 := fieldfollows1
1061 # Insert a sheet, sheetid = 1, that uses fieldfollows.ffid = 1
1062 prereq_sheets := fieldfollows1
1063 # A sheet identical to sheets1 but using a fieldfollow with a gcstatus.
1064 prereq_sheets_gcstatus := fieldfollows1_gcstatus
1065 # Deleting the last sheet deletes the related fieldfollow row.
1066 prereq_sheets_deletes_fieldfollows := sheets
1067 # Insert (in conjunction with sheet #1) a second sheet,
1068 # sheetid = 2, that uses fieldfollows.ffid = 2
1069 prereq_sheets_second := sheets fieldfollows2
1070 # Every sheets row must have a related intervals row.
1071 prereq_sheets_errors := sheets_second follows2_data
1072 # Populate 3 intervals for the first follow: 9:00, 9:01, 9:02
1073 prereq_intervals_first_follow := sheets follows1_data
1074 # Populate 3 more intervals for the 2nd follow: 10:00, 10:01, 10:02
1075 prereq_intervals := sheets_second follows2_data \
1076 intervals_first_follow followparts1 followparts2
1077 # Add intervals to the 3rd follow like those on intervals_first_follow.
1078 prereq_intervals_third_follow := sheets_third follows3_data
1079 # Add intervals to the 4th follow like those on intervals_first_follow.
1080 # (Sheets need 3rd sheet so this needs intervals for 3rd sheet.)
1081 prereq_intervals_fourth_follow := sheets_fourth follows4_data \
1082 intervals_third_follow
1083 prereq_intervals_onesheet := intervals_prereqs intervals_first_follow
1084 prereq_intervals_badtime := intervals_prereqs
1085 prereq_intervals_timeearly := intervals_prereqs
1086 prereq_intervals_timelate := intervals_prereqs
1087 # Delete all a sheet's intervals.
1088 # (This cascades to deleting the abandoned sheet.)
1089 prereq_intervals_abandonsheet := intervals
1090 # Populate 3 intervals for the sixth follow: 9:00, 9:01, 9:02
1091 prereq_intervals_sixth_follow := sheets_sixth follows6_data
1092
1093 # A field data collector cannot be in 2 places at once.
1094 # Update of fieldfollows: fieldfollows.collector
1095 # Needs filter: time
1096 prereq_fieldfollows_collector := intervals intervals_extra_2nd
1097 # A field data collector cannot be in 2 places at once.
1098 # Update of sheets: Move a sheet from fieldfollow 2 to fieldfollow 3.
1099 # Needs filter: time
1100 prereq_sheets_collector := intervals fieldfollows3 intervals_extra_2nd
1101 prereq_intervals_extra_2nd := intervals_prereqs intervals_first_follow
1102 # A field data collector cannot be in 2 places at once.
1103 # Insert into intervals: Put a interval on the third sheet for follow 2;
1104 # there is a time conflict at 9:00 for the collector.
1105 prereq_intervals_collector := intervals sheets_third
1106 # Insert a 3rd field follow to be used with the 3rd follow: ffid = 3
1107 # (And it can be used independently.)
1108 prereq_fieldfollows3 := followtypes people
1109 # Insert a 3rd sheet, using fieldfollows.ffid = 3, to be used independently.
1110 # (sheets.sheetid = 3)
1111 prereq_sheets_third := fieldfollows3
1112 # A field data collector cannot be in 2 places at once.
1113 # Update follows: Make follow 3 same date as follow 1
1114 # Needs filter: time
1115 prereq_follows_collector := intervals followparts6 \
1116 intervals_sixth_follow
1117 # Add follows 1-3 and intervals for all 3.
1118 prereq_intervals_extra_3rd := intervals sheets_third
1119 # Add follows 1-3 and intervals for all 3. Follow 3 interval times
1120 # and collector does not conflict with those of follow 1.
1121 # (The fifth sheet is used.)
1122 prereq_intervals_3rd_late := intervals sheets_fifth follows3_data
1123 prereq_follows_nomom := follow_prereqs
1124 # Populate the followparts part of the db for the first follow
1125 # MOM (mom) and KID (infant)
1126 prereq_followparts1 := follows1_data followpart_basic_prereqs demography
1127 # Test that follows must have related intervals. Insert of follows.
1128 # (Same as followparts1, but output keeps transaction failure.
1129 prereq_follows_intervals_f := follows1_data followpart_basic_prereqs \
1130 demography
1131 # Test that follows must have related intervals. Delete of intervals.
1132 # Needs filter (intid, time)
1133 prereq_follows_intervals_i := intervals_first_follow followparts1
1134 # Populate the followparts part of the db for the (first and) third follow
1135 # 2004-06-02, same as follow 1. With MOM (mom) and KID (infant)
1136 prereq_followparts13 := followparts1 follows3_data
1137 # Populate the followparts part of the db for the second follow
1138 # MO2 (mom) and KI2 (infant)
1139 prereq_followparts2 := followpart_prereqs follows2_data
1140 # Participants for follow 5, the old follow.
1141 # FE4 (mom) and FE6 (infant)
1142 prereq_followparts5 := followpart_basic_prereqs follows5_data female6
1143 # Participants for follow 6, the contemporary extra follow
1144 # FE4 (mom) and FE6 (infant)
1145 prereq_followparts6 := followpart_basic_prereqs follows6_data female6
1146 # Cannot be in the same follow twice.
1147 prereq_followparts_twice := followparts1
1148 # Cannot delete the mom from a follow
1149 prereq_followparts_deletemom := followparts1 intervals_first_follow
1150 prereq_biography_beforefollow := followparts1 intervals_first_follow
1151 prereq_biography_afterfollow := followparts1 intervals followparts2
1152 # An individual cannot be in a follow before entry into the study
1153 # population: followparts insert
1154 prereq_followparts_beforefollow := followpart_basic_prereqs family2
1155 # Cannot be in a follow after departure from the study population:
1156 # followparts insert
1157 prereq_followparts_afterfollow := followpart_basic_prereqs family2
1158 # Cannot be in a follow before entry into the study population: follows update
1159 prereq_follows_tooearly := followparts intervals
1160 # Needs filter (chimpid, departdate)
1161 prereq_follows_toolate := followparts intervals
1162 # Add a sibling (SIB) to follow 1.
1163 prereq_followparts_sib := followparts1 sib intervals_first_follow
1164 # Same as followparts_sib but without intervals for use as a prerequsite.
1165 prereq_followparts_sib_noi := followparts1 sib
1166 # The sib cannot be younger than the infant: insert of of followparts
1167 prereq_followparts_sibrev := follows1_data followpart_basic_prereqs sib
1168 prereq_biography_i_sibrev := followparts_sib
1169 prereq_biography_u_sibrev := followparts_sib
1170 # Add a twin (TWN) to the focals of the first follow.
1171 prereq_followparts_twins := followparts1 intervals_first_follow twins
1172 # Animals sharing a role in a follow must have the same birthdate.
1173 prereq_followparts_badtwin := followparts sib
1174 prereq_biography_badtwin := followparts_twins
1175 # Twins must have equal followparts.role values: update of followparts
1176 # Needs filter (fpid)
1177 prereq_badtwinrole_fp := followparts_twins followrole_twin
1178 prereq_badtwinrole_twins := followparts_sib
1179 # Needs filter (chimpid)
1180 prereq_follows_dup := followparts
1181 # Can't have two individuals in a follow on the same day: insert followparts
1182 prereq_followparts_dup := followpart_prereqs follows1_data follows3_data \
1183 followparts13 follows2_data
1184 prereq_followparts := followparts13 followparts2
1185 # Test that the mom in a follow is a mom: wrong mom, no adoptions
1186 prereq_followparts_if_badmom := follows1_data followpart_prereqs
1187 prereq_followparts_ub_badmom := follows1_data follows2_data intervals
1188 # Populate 4th follow on 2nd day.
1189 # (followid = 4) 2004-06-02, same day as follow 2 (Usually with MA3
1190 # (male adopted mom) and KI2 (infant).)
1191 prereq_follows4_data := follows1_data follows2_data
1192 # Insert followparts to a follow (followid=4) with an adopted mom.
1193 prereq_followparts_amom := followparts_amom_prereqs
1194 # Same as followparts_amom but with no intervals as prereqs.
1195 # Used strictly for prerequsites.
1196 prereq_followparts_amom_noi := followparts13 adoptions3 follows1_data \
1197 follows4_data
1198 # Insert followparts to a follow (followid=4) with an adopted parent
1199 # that's male and when the infant has no biological mom.
1200 prereq_followparts_amom_nomom := followparts_amom_prereqs
1201 # Insert a follow that has a kid who is too old as of the date of the follow
1202 prereq_followparts_amom_ktooold := followparts_amom_prereqs
1203 # Needs filter (follow.date)
1204 prereq_followparts_ub_ktooold := followparts_amom
1205 # Infant and sib must be less than 9 years old as of the follow date:
1206 # update follows
1207 prereq_followparts_uf_ktooold := followparts5
1208 # Adopted youth with no mom can't be in a follow before the
1209 # adoption date: insert into followparts
1210 prereq_followparts_if_badadate := followparts_amom_prereqs
1211 # Adopted youth with mom can't be in a follow before the
1212 # adoption date: insert into followparts
1213 prereq_followparts_if_badadate2 := followparts_amom_prereqs
1214 # Mom must be mom on follow: update biography_data to make not a mom
1215 # Needs filter (follow.date)
1216 prereq_followparts_ub_rmmom := followparts_amom intervals \
1217 intervals_third_follow \
1218 intervals_fourth_follow
1219 prereq_followparts_replace_bio := followparts_amom
1220 # Cannot participate in a follow before being
1221 # adopted: update of adoptions.adate
1222 prereq_followparts_ua_badadate := followparts_amom
1223 # Cannot participate in a follow before being adopted: delete of adoptions
1224 prereq_followparts_da_noadopt := followparts_amom
1225
1226 # prerequsites for groups
1227
1228 # Have a follows.gcstatus if and only if there is a raw_groups row.
1229 #
1230 # Insert raw_groupmembers to go with intervals_first_follow.
1231 prereq_raw_groupmembers1 := raw_groups1 gm_origins
1232 # Can have a follows.gcstatus when there's a raw_groups row.
1233 # (Give the first fieldfollow a gcstatus.)
1234 prereq_gcstatus := gcstatuses raw_groupmembers1
1235 # Insert a raw_groups row for follow 1 as a prerequsite for later tests.
1236 prereq_raw_groups1 := intervals_first_follow followparts1
1237 # Must have a follows.gcstatus if there's a raw_groups row.
1238 # Insert of raw_groups.
1239 prereq_gcstatus_raw_groups_i := intervals_first_follow followparts1
1240 # Must not have a gcstatus if there is no raw_groups row.
1241 # Delete a raw_groups row without updating gcstatus.
1242 prereq_gcstatus_raw_groups_d := gcstatus
1243 # Must have a follows.gcstatus if there's a raw_groups row.
1244 # Update of sheets. Start with a follow 1 with a raw_groups row
1245 # fieldfollow 2 with a null gcstatus.
1246 # Change the sheets rows to use fieldfollow 2 and delete fieldfollow 1.
1247 # (Error is on insert commit, since it checks using the updated value.)
1248 prereq_gcstatus_null_sheets := gcstatus fieldfollows2
1249 # Must not have a follows.gcstatus if there's no raw_groups row.
1250 # Insert of sheets.
1251 # Identical to intervals_first_follow but with different prerequsites
1252 # that have a non-null fieldfollows.gcstatus value.
1253 prereq_gcstatus_nonnull_sheets := sheets_gcstatus follows1_data
1254 # Must have a gcstatus if there is a raw_groups row.
1255 # Update of fieldfollows.
1256 prereq_gcstatus_null_fieldfollows := gcstatus
1257 # Must not have a gcstatus when there are no raw_groups rows.
1258 # Update of fieldfollows.
1259 prereq_gcstatus_nonnull_fieldfollows := intervals_first_follow followparts1 \
1260 gcstatuses
1261
1262 # get lots of intervals in, for four follows
1263 # We'll need 4 sheets (without fussing and having
1264 # multiple sheets per follow.)
1265 # A forth field follow, for use with the 3rd. ffid = 4
1266 prereq_fieldfollows4 := fieldfollows3
1267 prereq_sheets_fourth := sheets_third fieldfollows4
1268 # An extra fieldfollows for use with the 4th when we need it. ffid = 5
1269 #prereq_fieldfollows5 :=
1270 # A fieldfollow for use with the 6th follow (and independently), ffid = 6
1271 # Has the same collector as fieldfollow1 so we can generate a conflict.
1272 prereq_fieldfollows6 := followtypes people
1273 # An extra early fieldfollow ffid = 7.
1274 prereq_fieldfollows7 := followtypes people
1275 # An extra sheet for when we need it.
1276 prereq_sheets_fifth := fieldfollows5
1277 # A sheet for fieldfollow 6, for independent use. (sheetid = 6)
1278 prereq_sheets_sixth:= fieldfollows6
1279 # And add intervals from 9am to 5pm for each follow.
1280 # followparts_amom provides mom/infant for 4th follow.
1281 prereq_intervals_lots_follow1 := sheets followparts1
1282 prereq_intervals_lots_follow2 := sheets_second followparts2
1283 prereq_intervals_lots_day2 := sheets_fourth followparts_amom_noi
1284 prereq_intervals_lots := intervals_lots_day1 intervals_lots_day2
1285 # Now that there's intervals we add lots of groups.
1286 # We'll have all the follows and all the intervals when
1287 # working with groups.
1288 prereq_groups_day1 := intervals_lots
1289 prereq_groups_day2 := intervals_lots
1290 prereq_groups := groups_day1 groups_day2
1291 # The groups all need the follow mom as a member:
1292 # Test to be sure this is true.
1293 # The groups all need the follow mom as a member: update of intervals
1294 prereq_groups_nomom_intervals := intervals_lots_follow1
1295 # The groups all need the follow mom as a member: update of followparts
1296 prereq_groups_nomom_followparts := groups_momkid_900 family2
1297 # The groups all need the follow mom as a member: update of groupmembers
1298 # (Could use groups_momkid_900 instead of groupinfants to be faster.)
1299 # Needs filter (date, time)
1300 prereq_groups_nomom_groupmembers_u := groupinfants male4
1301 # The groups all need the follow mom as a member: delete of groupmembers
1302 # (Could use groups_momkid_900 instead of groupinfants to be faster.)
1303 # Needs filter (date, time)
1304 prereq_groups_nomom_groupmembers_d := groupinfants
1305 # Moms for the follows in the first day.
1306 prereq_groupmoms_day1 := groups_day1
1307 # Moms for the follows in the second day.
1308 prereq_groupmoms_day2 := groups_day2
1309 prereq_groupmoms := groupmoms_day1 groupmoms_day2
1310 # The groups all need to have intervals: update of intervals
1311 # (This is probably not implemented correctly now that
1312 # setting gid to null triggers group comp lookup.
1313 # It probably only works because there's not anything in raw_groups.)
1314 # Needs filter (intid, gid, time)
1315 prereq_groups_onintervals_intervals_u := groupinfants
1316 # Add one group with just the mom to the first follow.
1317 prereq_groups_onemom := intervals_lots_follow1
1318 # Add one group with just the mom to the first follow, 9:00
1319 prereq_groups_onemom_900 := intervals_first_follow followparts1
1320 # Add one group with just the mom to the first follow, 9:02
1321 # When we use this, we want the kid to be more than 5 years old.
1322 prereq_groups_onemom902 := intervals_first_follow followparts1 kid5
1323 # The groups all need to have intervals: delete of intervals
1324 prereq_groups_onintervals_intervals_d := groups_onemom kid5
1325 # Infants for the follows in the first day.
1326 prereq_groupinfants_day1 := groupmoms_day1
1327 # Infants for the follows in the second day.
1328 prereq_groupinfants_day2 := groupmoms_day2
1329 # Have the infants and moms in the follow be group members.
1330 prereq_groupinfants := groupmoms groupinfants_day1 groupinfants_day2
1331 # Add male4 (MA4), and female1 (FE1)
1332 # to groups of follow 1, and male2 (MA2) and female2 (FE2)
1333 # to groups of follow 2. (Follows 1 and 2 share the same
1334 # date, and follows 3 and 4 share the next date.)
1335 prereq_grouplots_day1 := groupinfants_day1 male4 male5 female1 female2
1336 # Add male4 (MA4), and female1 (FE1)
1337 # to groups of follow 3, and male2 (MA2) and female2 (FE2)
1338 # to groups of follow 4. (Follows 1 and 2 share the same
1339 # date, and follows 3 and 4 share the next date.)
1340 prereq_grouplots_day2 := groupinfants_day2 male4 male5 female1 female2
1341 prereq_grouplots := grouplots_day1 grouplots_day2
1342 prereq_grouplots_vacuum_analyze := grouplots
1343 # Individual in group not in study group, enters late: insert into groupmembers
1344 prereq_groups_a_n_s_groupmembers_e := grouplots female3
1345 # Individual in group not in study group,
1346 # leaves early: insert into groupmembers
1347 prereq_groups_a_n_s_groupmembers_d := grouplots male6
1348 # Individual in group not in study group, enters late: update of biography_data
1349 # Needs filter, follows.date
1350 prereq_groups_a_n_s_biography_e := grouplots
1351 # Individual in group not in study group,
1352 # leaves early: update of biography_data
1353 # Needs filter, follows.date
1354 prereq_groups_a_n_s_biography_d := grouplots
1355 # Individual in group not in study group, enters late: update of intervals
1356 # Needs filter (intid)
1357 prereq_groups_a_n_s_intervals_e := grouplots_day2
1358 # Individual in group not in study group, leaves early: update of intervals
1359 # Needs filter (intid)
1360 prereq_groups_a_n_s_intervals_d := grouplots_day1
1361 # Individual in group not in study group, enters late: update of follows
1362 prereq_groups_a_n_s_follows_e := grouplots
1363 # Individual in group not in study group, departs early: update of follows
1364 prereq_groups_a_n_s_follows_d := grouplots
1365 # Add swelling to a group member FE1.
1366 prereq_swelling := grouplots
1367 # Can't give swelling to a male (MA5): update of groupmembers
1368 # Needs filter (gmid)
1369 prereq_swelling_notmale := grouplots
1370 # Can't give swelling to a male: update of biography_data
1371 prereq_swelling_notmale_biography := swelling
1372 # Test that you can have swelling at the minimum age.
1373 prereq_swelling_minage := swelling
1374 # Can't have swelling at less than the minimum age: update biography_data
1375 prereq_swelling_nma_biography := swelling_minage
1376 # Can't have swelling at less than the minimum age: update of groupmembers
1377 # Needs filter (gmid)
1378 prereq_swelling_nma_groupmembers := grouplots
1379 # Can't have swelling at less than the minimum age: update of intervals
1380 # Needs filter (intid, time)
1381 prereq_swelling_nma_intervals := groupinfants female2
1382 # Can't have a swelling at less than the minimum age: update of follows
1383 prereq_swelling_nma_follows := swelling_minage
1384
1385 # Prerequsites for distances
1386
1387 # Add lots of distances to the db for follows 1-4, 9:00, 10:00, 11:00
1388 prereq_distanceparts_lots := intervals_lots followparts_sib_noi distancecodes
1389 # Must have 2 individuals per distance measurement: insert of distances
1390 prereq_not2dparts_d := intervals distancecodes
1391 # Add a single distance row to the db, for follow 1, 9:00.
1392 # (Technically we don't need followparts1 for this, but all the
1393 # tests that depend on distance_one do.)
1394 prereq_distance_one := intervals_first_follow distancecodes followparts1
1395 # Insert a single distanceparts row, follow 1, 9:00.
1396 prereq_distanceparts_one := distance_one
1397 # Distance must be measured between two different individuals.
1398 prereq_distanceparts_twice := distanceparts_one
1399 # Must have 2 individuals per distance measurement: insert of distanceparts
1400 prereq_not2dparts_dpi := distance_one
1401 # Must have 2 individuals per distance measurement: delete of distanceparts
1402 prereq_not2dparts_dpd := distanceparts_lots
1403 # Distancepart must = role of followpart: insert of distanceparts
1404 # (distoff is distancepartrole-of-followpart)
1405 prereq_distoffp_dp := distanceparts_lots
1406 # Distancepart must = role of followpart: update of followparts
1407 prereq_distoffp_fp := distanceparts_lots followrole_twin
1408 # Put the 9:30 interval onto it's own sheet so we can play around.
1409 prereq_ninethirty_sheet := intervals_lots five_sheets
1410 # An extra 9:30 distancepart pair for follow1.
1411 prereq_distancepart_extra := distancecodes ninethirty_sheet
1412 # An extra 9:30 distancepart pair for follow1, but without a 5th sheet.
1413 prereq_distancepart_extra2 := intervals_lots distancecodes
1414 # Set the 'KID' role for follow3 to 'T' (twin)
1415 prereq_follow3_twin := followparts13 followrole_twin
1416 # Distancepart must = role of followpart: update of intervals
1417 prereq_distoffp_intervals := distancepart_extra follow3_twin
1418 # Distancepart must = role of followpart: update of distances
1419 prereq_distoffp_distances := distanceparts_lots distancepart_extra2 \
1420 follow3_twin
1421 # Distancepart must be on the followparts table: update of intervals
1422 # (distonfp is distancepart-on-followpart)
1423 # Needs filter, animid (twice)
1424 prereq_distonfp_intervals := distancepart_extra
1425 # Distancepart must be on the followparts table: update of distances
1426 # Needs filter, chimpid (twice)
1427 prereq_distonfp_distances := distancepart_extra
1428 # Distancepart must be on the followparts table: insert of distanceparts
1429 # Needs filter, dpid, participant (twice)
1430 prereq_distonfp_dp := distance_one family2
1431 # Distancepart must be on the followparts table: delete of followparts
1432 # Needs filter intervals.time, followparts.animid (twice)
1433 prereq_distonfp_fpd := distanceparts_lots
1434 # Distancepart must be on the followparts table: update of followparts
1435 # Needs filter on dpid
1436 prereq_distonfp_fpu := distanceparts_lots sib2
1437 # Distance can be measured between 2 individuals at most once per interval:
1438 # insert of distanceparts
1439 # (duplicate of distancepart_extra)
1440 prereq_disttwice_dp := distancepart_extra
1441 # Distance can be measured between 2 individuals at most once per interval:
1442 # update of distances
1443 # Needs filter, distanceparts.participant, distid
1444 prereq_disttwice_d := distanceparts_lots
1445
1446 # Distances and groups
1447 # Bug: The right way to do these is to use a follow where the kid
1448 # is > 5 years old so as not to run into groupmembership
1449 # requirements where both mom and kid must be in groupmembers.
1450 # But this works for now.
1451 # Individuals who's distance is measured must be in groupmembers:
1452 # insert into distanceparts
1453 # Insert KID into follow 1, 9:00 interval (but KID is not in groupmembers).
1454 prereq_dp_in_gm_dp := groups_onemom_900 distanceparts_one
1455 # Add one group with both the mom and the kid in the first follow, 9:00am.
1456 # (Prerequsites take care of the mom, this just adds KID.)
1457 prereq_groups_momkid_900 := groups_onemom_900
1458 # Add one group with both the mom and the kid in the first follow, 9:02am.
1459 # (Prerequsites take care of the mom, this just adds KID.)
1460 prereq_groups_momkid902 := groups_onemom902
1461 # Create a distanceparts pair for 9:00 for the first follow.
1462 # Insert KID into follow 1, 9:00 interval.
1463 prereq_distanceparts900 := groups_momkid_900 distanceparts_one
1464 # Individuals who's distance is measured must be in groupmembers:
1465 # update of distances
1466 prereq_dp_in_gm_d := distanceparts900 groups_onemom902
1467 # Individuals who's distance is measured must be in groupmembers:
1468 # update of intervals
1469 prereq_dp_in_gm_i := distanceparts900 groups_onemom902
1470 # Individuals who's distance is measured must be in groupmembers:
1471 # delete of groupmembers
1472 prereq_dp_in_gm_gm_d := distanceparts900
1473 # Individuals who's distance is measured must be in groupmembers:
1474 # update of groupmembers
1475 prereq_dp_in_gm_gm_u := distanceparts900 family2
1476 # When the Distances.Distance value is &gmi_distunk; (99) the
1477 # Distances.Uncertain value must be TRUE.
1478 prereq_dp_distunk_is_true := distance_one
1479
1480 #
1481 # Events
1482 #
1483
1484 # The exclusive_behavior flag must be true when the restricted flag is true.
1485 prereq_behaviors_exclude_restricted := behaviors
1486 # behaviors.both_directions must be null when none of the
1487 # actor or actee columns are true.
1488 prereq_behaviors_both_directions_null := behaviors
1489 # behaviors.both_directions must be non-null when any of the
1490 # actor or actee columns are true.
1491 prereq_behaviors_both_directions_non_null := behaviors
1492 # behaviors.baboon must be null when non-focals are excluded
1493 # from the interaction.
1494 prereq_behaviors_baboon_null := behaviors
1495 # behaviors.baboon must be non-null when non-focals are allowed
1496 # in the interaction.
1497 prereq_behaviors_baboon_non_null := behaviors
1498
1499 # Test the null_iff_not_true macro (against behaviors.)
1500 # Test the null/false combo.
1501 prereq_null_iff_not_true_nf := behaviors
1502 # Test the null/true combo.
1503 prereq_null_iff_not_true_nt := behaviors
1504 # Test the true/false combo.
1505 prereq_null_iff_not_true_tf := behaviors
1506 # Test the true/true combo.
1507 prereq_null_iff_not_true_tt := behaviors
1508
1509 # Add lots of events to the db for follows 1-4, 9:00, 10:00, 11:00
1510 # This is just an empty file so that prerequsites are executed.
1511 # This one has infant mom play
1512 prereq_parts_lots := parts_mostly_prereqs parts_lots_infant_mom_play
1513
1514 # Add lots of dad (DAD) grooming mom events to the db for follows 1-4
1515 # 9:00, 10:00, 11:00
1516 prereq_parts_lots_dad_mom_grooming := intervals_lots behaviors
1517
1518 # Add lots of events to the db for follows 1-4, 9:00, 10:00, 11:00
1519 # This is just an empty file so that prerequsites are executed.
1520 # This one has infant self play
1521 prereq_parts_lots_i_selfplay := parts_mostly_prereqs \
1522 parts_lots_infant_self_play
1523
1524 # Add lots of infant eating events to the db for follows 1-4
1525 # 9:00, 10:00, 11:00
1526 prereq_parts_lots_infant_eating := intervals_lots behaviors foodkinds foodparts
1527
1528 # Add lots of infant grooming mom events to the db for follows 1-4
1529 # 9:00, 10:00, 11:00
1530 prereq_parts_lots_infant_mom_grooming := intervals_lots behaviors
1531
1532 # Add lots of infant playing with mom in a directed fashion
1533 # events to the db for follows 1-4, 9:00, 10:00, 11:00
1534 prereq_parts_lots_infant_mom_play := intervals_lots behaviors play_types
1535
1536 # Add lots of infant nursing on mom (in a directed fashion)
1537 # events to the db for follows 1-4, 9:00, 10:00, 11:00
1538 prereq_parts_lots_infant_nursing := intervals_lots behaviors
1539
1540 # Add lots of infant riding on mom
1541 # events to the db for follows 1-4, 9:00, 10:00, 11:00
1542 prereq_parts_lots_infant_mom_rides := intervals_lots behaviors riding_postures
1543
1544 # Add lots of infant 'other' events for follows 1-4, 9:00, 10:00, 11:00.
1545 prereq_parts_lots_infant_other := intervals_lots behaviors
1546
1547 # Add lots of infant resting events for follows 1-4, 9:00, 10:00, 11:00.
1548 prereq_parts_lots_infant_resting := intervals_lots behaviors \
1549 positions resting_postures
1550
1551 # Add lots of infant self play
1552 # events to the db for follows 1-4, 9:00, 10:00, 11:00
1553 prereq_parts_lots_infant_self_play := intervals_lots behaviors play_types
1554
1555 # Add lots of infant grooming sib events to the db for follows 1-4
1556 # 9:00, 10:00, 11:00
1557 prereq_parts_lots_infant_sib_grooming := intervals_lots behaviors \
1558 followparts_sib_noi
1559
1560 # Add lots of mom grooming baboon events to the db for follows 1-4
1561 # 9:00, 10:00, 11:00
1562 prereq_parts_lots_mom_baboon_grooming := intervals_lots behaviors
1563
1564 # Add lots of mom grooming dad (DAD) events to the db for follows 1-4
1565 # 9:00, 10:00, 11:00
1566 prereq_parts_lots_mom_dad_grooming := intervals_lots behaviors
1567
1568 # Add lots of mom eating events to the db for follows 1-4
1569 # 9:00, 10:00, 11:00
1570 prereq_parts_lots_mom_eating := intervals_lots behaviors foodkinds foodparts
1571
1572 # Add lots of mom grooming infant events to the db for follows 1-4
1573 # 9:00, 10:00, 11:00
1574 prereq_parts_lots_mom_infant_grooming := intervals_lots behaviors
1575
1576 # Add lots of mom playing with male (MA5) in a non-directed fashion
1577 # events to the db for follows 1-4, 9:00, 10:00, 11:00
1578 prereq_parts_lots_mom_ma5_play_nondirected := intervals_lots behaviors \
1579 male5 play_types
1580
1581 # Add lots of mom 'other' events for follows 1-4, 9:00, 10:00, 11:00.
1582 prereq_parts_lots_mom_other := intervals_lots behaviors
1583
1584 # Add lots of mom resting events for follows 1-4, 9:00, 10:00, 11:00.
1585 prereq_parts_lots_mom_resting := intervals_lots behaviors \
1586 positions resting_postures
1587
1588 # Add lots of mom grooming unknown (UNK) events to the db for follows 1-4
1589 # 9:00, 10:00, 11:00
1590 prereq_parts_lots_mom_unknown_grooming := intervals_lots behaviors unk
1591
1592 # Add lots more of mom grooming unknown (UNK) events to the db for follows 1-4
1593 # 9:00, 10:00, 11:00
1594 prereq_parts_lots_mom_unknown_grooming2 := intervals_lots behaviors unk
1595
1596 # Just like parts_lots but with a slightly different set of intervals
1597 # where the 9:00 interval of follow1 is on it's own sheet, sheet5.
1598 prereq_parts_lots_after_noc_sheet := nineoclock_sheet followparts_sib_noi \
1599 behaviors unk play_types foodkinds \
1600 foodparts
1601
1602 # Add an grooming event where dad grooms mom at 9:00 in follow 1.
1603 # Dad is, obviously, not a focal in the follow.
1604 prereq_other_mom_grooming := intervals_lots behaviors male5
1605
1606 # Add an grooming event where dad grooms infant at 9:00 in follow 1.
1607 # Dad is, obviously, not a focal in the follow.
1608 prereq_other_grooming_infant := intervals_lots behaviors
1609
1610 # Add an grooming event where infant (KID) grooms dad (DAD)
1611 # at 9:00 in follow 1.
1612 # Dad is, obviously, not a focal in the follow.
1613 prereq_infant_grooming_other := intervals_lots behaviors male5
1614
1615
1616 # Add an event where infant (KID) plays with dad (DAD)
1617 # as participants (non-directed) at 9:00 in follow 1.
1618 # Dad is, obviously, not a focal in the follow.
1619 prereq_infant_play_other_participant := intervals_lots behaviors male5 \
1620 play_types
1621
1622 # Add an grooming event where sib (SIB) grooms infant (KID)
1623 # at 9:00 in follow 1.
1624 prereq_sib_grooms_infant := intervals_lots behaviors followparts_sib_noi
1625
1626 # Add a play event where sib (SIB) plays with a non-focal (DAD) in
1627 # a non-directed way (participant) at 9:00 in follow 1.
1628 prereq_sib_play_other_participant := intervals_lots behaviors \
1629 followparts_sib_noi male5 play_types
1630
1631 # Add a eating event where the sib (SIB) eats at 9:00 in follow 1.
1632 prereq_sib_eats := intervals_lots behaviors followparts_sib_noi foodkinds \
1633 foodparts
1634
1635 # Add an grooming event where dad grooms sib at 9:00 in follow 1.
1636 # Dad is, obviously, not a focal in the follow.
1637 prereq_other_grooming_sib := intervals_lots behaviors male5 followparts_sib_noi
1638
1639 # Add an grooming event where sib grooms dad at 9:00 in follow 1.
1640 # Dad is, obviously, not a focal in the follow.
1641 prereq_sib_grooming_other := intervals_lots behaviors male5 followparts_sib_noi
1642
1643 # Add a grooming event where the mom grooms a baboon at 9:00 in follow1.
1644 prereq_mom_grooming_baboon := intervals_lots behaviors
1645
1646 # An individual can participate in an event only once.
1647 # Try to have mom be both actor and actee in grooming.
1648 # Needs filter (pid, part)
1649 prereq_parts_uniq_ind := intervals_first_follow followparts1 behaviors
1650
1651 # An individual must be on or after entrydate to be a participant in an
1652 # event.
1653 #
1654 # Insert into parts. Female3 born after follow1
1655 # Filter on pid, since using a single insert statement
1656 prereq_parts_tooearly := intervals_first_follow followparts1 behaviors \
1657 female3
1658 # Update biography.
1659 prereq_parts_tooearly_b := intervals_first_follow followparts1 behaviors \
1660 female1
1661 # Update follows.
1662 prereq_parts_tooearly_f := intervals_first_follow followparts1 behaviors \
1663 female2
1664
1665 # An individual must be on or before departdate to be a participant in
1666 # an event.
1667 #
1668 # Insert into parts. Female5 dies before follow1
1669 # Filter on pid, since using a single insert statement.
1670 prereq_parts_toolate := intervals_first_follow followparts1 behaviors \
1671 female5
1672 # Update biography.
1673 prereq_parts_toolate_b := intervals_first_follow followparts1 behaviors \
1674 female1
1675 # Update follows.
1676 prereq_parts_toolate_f := intervals_first_follow followparts1 behaviors \
1677 female1
1678
1679 #
1680 # An event must be unique.
1681 #
1682 # Update of events
1683 # Filter on (eid, participant)
1684 prereq_event_unique_e := intervals_first_follow followparts1 behaviors
1685
1686 # Update of parts.
1687 prereq_event_unique_p := intervals_first_follow followparts1 behaviors \
1688 female1
1689
1690 #
1691 # behaviors.type
1692 # Test one 1 to many relationship and one 1 to 1 relationship.
1693 #
1694
1695 # An eating event allows 1 eats row.
1696 # Mom (MOM) eats at 9:00 in follow 1.
1697 prereq_eats1 := eats foodkinds foodparts
1698
1699 # An eating event allows more than one eats row.
1700 # Mom (MOM) eats more at 9:00 in follow 1.
1701 prereq_eats2 := eats1
1702
1703 # At least one EATS row is required for an eating event.
1704 # Insert into events without an EATS row tests events insert trigger.
1705 # Mom (MOM) eats at 9:00 in follow 1.
1706 prereq_eats0 := event_subtable_prereqs
1707 # Same as eats0 but succeeds.
1708 prereq_eats := event_subtable_prereqs
1709 # Delete from EATS tests eats delete trigger.
1710 prereq_eats0_d := eats1
1711
1712 # An eating event cannot have a RIDES row.
1713 # Tests rides insert trigger.
1714 prereq_eats_rides := eats riding_postures
1715
1716 # A riding event allows 1 rides row.
1717 # Add RIDES row to the riding event for KID, followid 1, 9:00.
1718 prereq_rides1 := rides riding_postures
1719
1720 # A rides row is required for a riding event.
1721 # Insert into events without a RIDES row tests events insert trigger.
1722 # Infant (KID) rides on non-focal (DAD) at 9:00 in follow 1.
1723 prereq_rides0 := event_subtable_prereqs
1724 # Same as rides0 but succeeds.
1725 prereq_rides := event_subtable_prereqs
1726 # Delete from RIDES tests rides delete trigger.
1727 prereq_rides0_d := rides1
1728
1729 # A riding event does not allow more than one rides row.
1730 # Tests events insert trigger.
1731 # riding event for infant (KID), followid 1, 9:00.
1732 prereq_rides2 := rides1
1733
1734 # A riding event cannot have an eats row.
1735 # Tests rides insert trigger.
1736 prereq_rides_eats := rides foodkinds foodparts
1737
1738 # A sample fishing event, without a fished row.
1739 prereq_fishing := event_subtable_prereqs
1740 # Add a fished row to the fishing event.
1741 prereq_fishing1 := fishing foodkinds foodparts fishing_results
1742 # Fishing events must have fishable foodparts: update foodparts
1743 prereq_fishing_fishable_fp_u := fishing1
1744 # Fishing events must have fishable foodparts: insert fished
1745 prereq_fishing_fishable_fp_i := fishing foodkinds foodparts fishing_results
1746 # Fishing events must have fishable foodkinds: update foodkinds
1747 prereq_fishing_fishable_fk_u := fishing1
1748 # Fishing events must have fishable foodkinds: insert fished
1749 prereq_fishing_fishable_fk_i := fishing foodkinds foodparts fishing_results
1750
1751 # A sample resting event.
1752 # Mom (MOM) rests at 9:00 in follow 1.
1753 prereq_resting := event_subtable_prereqs resting_postures positions
1754
1755 # A sample play event.
1756 # Mom (MOM) plays at 9:00 in follow 1.
1757 prereq_plays := event_subtable_prereqs play_types
1758
1759 # A sample vocalization event.
1760 # Mom (MOM) vocalizes at 9:00 in follow 1.
1761 prereq_vocs := event_subtable_prereqs vocalizations
1762
1763 #
1764 # At least one participant in an event must be a focal.
1765 #
1766
1767 # Update parts, change participant
1768 # (pif = part is focal)
1769 prereq_pif_u_parts := parts_lots_i_selfplay
1770
1771 # Delete from parts
1772 prereq_pif_d_parts := parts_lots_i_selfplay
1773
1774 # Update events, change interval to a different follow
1775 prereq_pif_events := parts_lots_i_selfplay
1776
1777 # Put the 9:00 interval onto it's own sheet so we can play around.
1778 prereq_nineoclock_sheet := intervals_lots five_sheets
1779 # Update intervals, change follow
1780 # Needs filter (behavior, parts.participant)
1781 prereq_pif_intervals := parts_lots_after_noc_sheet
1782
1783 # Update followparts, change focal
1784 # Needs filter (behavior, time, parts.participant)
1785 # (Use to test for followparts update of behavior/parts.part combo?)
1786 prereq_pif_followparts_u := parts_lots si2
1787
1788 # Delete focal from followparts
1789 # Update followparts, delete focal
1790 # Needs filter (behavior, time, parts.participant)
1791 prereq_pif_followparts_d := parts_lots
1792
1793 #
1794 # Tests of behaviors
1795 #
1796 # Update behaviors so that mom can't be the actor (grooming).
1797 # Needs filter: follows.date, mother, time, baboon, participant
1798 prereq_behaviors_mom_actor := parts_lots
1799 # Update behaviors so that mom can't be the actee (grooming).
1800 # Needs filter: follows.date, mother, time, baboon, participant
1801 prereq_behaviors_mom_actee := parts_lots
1802 # Update behaviors so that mom can't be a participant (play).
1803 # Needs filter: follows.date, mother, time, baboon, participant
1804 prereq_behaviors_mom_participant := parts_lots
1805 # Update behaviors so that mom can't have the behavior by herself (eating).
1806 # Needs filter: follows.date, mother, time, baboon, participant
1807 prereq_behaviors_mom_self := parts_lots
1808 # Update behaviors so that mom can't have a non-focal actor (grooming).
1809 prereq_behaviors_mom_nf_actor := parts_lots other_mom_grooming
1810 # Update behaviors so that mom can't have a non-focal actee (grooming).
1811 # Needs filter: follows.date, mother, time, baboon, participant
1812 prereq_behaviors_mom_nf_actee := parts_lots
1813 # Update behaviors so that mom can't have a nonfocal participant (play).
1814 # Needs filter: follows.date, mother, time, baboon, participant
1815 prereq_behaviors_mom_nf_participant := parts_lots
1816
1817 # Update behaviors so that infant can't be the actor (grooming).
1818 # Needs filter: follows.date, mother, time, baboon, participant
1819 prereq_behaviors_infant_actor := parts_lots
1820 # Update behaviors so that infant can't be the actee (grooming).
1821 # Needs filter: follows.date, mother, time, baboon, participant
1822 prereq_behaviors_infant_actee := parts_lots
1823 # Update behaviors so that infant can't be a participant (play).
1824 # Needs filter: follows.date, mother, time, baboon, participant
1825 prereq_behaviors_infant_participant := parts_lots infant_play_other_participant
1826 # Update behaviors so that infant can't have the behavior by herself (eating).
1827 # Needs filter: follows.date, mother, time, baboon, participant
1828 prereq_behaviors_infant_self := parts_lots
1829 # Update behaviors so that infant can't have a non-focal actor (grooming).
1830 prereq_behaviors_infant_nf_actor := parts_lots other_grooming_infant
1831 # Update behaviors so that infant can't have a non-focal actee (grooming).
1832 # Needs filter: follows.date, mother, time, baboon, participant
1833 prereq_behaviors_infant_nf_actee := parts_lots infant_grooming_other
1834 # Update behaviors so that infant can't have a nonfocal participant (play).
1835 # Needs filter: follows.date, mother, time, baboon, participant
1836 prereq_behaviors_infant_nf_participant := parts_lots \
1837 infant_play_other_participant
1838
1839 # Update behaviors so that sib can't be the actor (grooming).
1840 prereq_behaviors_sib_actor := parts_lots sib_grooms_infant
1841 # Update behaviors so that sib can't be the actee (grooming).
1842 # Needs filter: follows.date, mother, time, baboon, participant
1843 prereq_behaviors_sib_actee := parts_lots
1844 # Update behaviors so that sib can't be a participant (play).
1845 prereq_behaviors_sib_participant := parts_lots sib_play_other_participant
1846 # Update behaviors so that sib can't have the behavior by herself (eating).
1847 prereq_behaviors_sib_self := parts_lots sib_eats
1848 # Update behaviors so that sib can't have a non-focal actor (grooming).
1849 prereq_behaviors_sib_nf_actor := parts_lots other_grooming_sib
1850 # Update behaviors so that sib can't have a non-focal actee (grooming).
1851 prereq_behaviors_sib_nf_actee := parts_lots sib_grooming_other
1852 # Update behaviors so that sib can't have a nonfocal participant (play).
1853 prereq_behaviors_sib_nf_participant := parts_lots \
1854 sib_play_other_participant
1855 # Update behaviors so that a baboon cannot participate.
1856 # Needs filter (mother, time, date, participant, part)
1857 prereq_behaviors_mom_baboon := parts_lots mom_grooming_baboon
1858
1859 # Test that parts obeys the columns on behaviors having to do with
1860 # actor, actee, participant, self, nf_actor, nf_actee, nf_participant.
1861 # Do updates so there's no worries about events/parts trigger order.
1862
1863 # Update parts: mom is not supposed to be an actor.
1864 # Eating event for mom (MOM) at 9:00 in follow1
1865 prereq_parts_mom_actor := parts_lots
1866 # Update parts: mom is not supposed to be an actee.
1867 # Eating event for mom (MOM) at 9:00 in follow 1.
1868 prereq_parts_mom_actee := parts_lots
1869 # Update parts: mom is not supposed to be a participant
1870 # Eating event for mom (MOM) at 9:00 in follow 1.
1871 prereq_parts_mom_participant := parts_lots
1872 # Update parts: mom is not supposed to be self.
1873 # Change riding event for mom (MOM) so mom is self at 9:00 in follow 1.
1874 prereq_parts_mom_self := parts_lots parts_lots_infant_mom_rides
1875 # Update parts: mom is not supposed to have an actor nonfocal partner.
1876 # First change play to not allow nonfocal mom partner to be actor,
1877 # then change mom non-directed play with ma5 so ma5 is actor.
1878 prereq_parts_mom_nf_actor := parts_lots_mom_ma5_play_nondirected
1879 # Update parts: mom is not supposed to have an actee nonfocal partner.
1880 # First change play to not allow nonfocal mom partner to be actee,
1881 # then change mom non-directed play with ma5 so ma5 is actee.
1882 prereq_parts_mom_nf_actee := parts_lots_mom_ma5_play_nondirected
1883
1884 # Test that events obeys the columns on behaviors having to do with
1885 # actor, actee, participant, self, nf_actor, nf_actee, nf_participant.
1886 # Do updates so there's no worries about events/parts trigger order.
1887
1888 # Update events: mom is not supposed to be an actor.
1889 # Change mom grooming infant event to an other event.
1890 prereq_events_mom_actor := parts_lots
1891 # Update events: mom is not supposed to be an actee.
1892 # Change infant grooming mom event to an other event.
1893 prereq_events_mom_actee := parts_lots
1894 # Update events: mom is not supposed to be a participant.
1895 # Change mom playing with MA5 in a non-directed way event to an other event.
1896 prereq_events_mom_participant := parts_lots
1897 # Update events: mom is not supposed to be a non-social participant "self".
1898 # Change mom eating to a begging event.
1899 prereq_events_mom_self := parts_lots
1900 # Update events: mom is not supposed to have an actor nonfocal partner.
1901 # First make 'other' allow mom to be actee,
1902 # then change dad grooming mom to be an "other" behavior.
1903 prereq_events_mom_nf_actor := parts_lots parts_lots_dad_mom_grooming
1904 # Update events: mom is not supposed to have an actee nonfocal partner.
1905 # First make 'other' allow mom to be actor,
1906 # then change mom grooming dad to be an "other" behavior.
1907 prereq_events_mom_nf_actee := parts_lots parts_lots_dad_mom_grooming
1908 # Update events: mom is not supposed to be with a nonfocal participant.
1909 # Change mom playing with MA5 in a non-directed way event to an other event.
1910 prereq_events_mom_nf_participant := parts_lots
1911
1912 # Test of behaviors.position.
1913 # Update behaviors so that position is required.
1914 # Needs filter: date, mother, time, baboon, participant
1915 prereq_behaviors_position_true := parts_lots
1916 # Update behaviors so that position must be null.
1917 prereq_behaviors_position_false := resting
1918 # Insert a resting event that does not have the right position value.
1919 prereq_events_position := event_subtable_prereqs resting_postures positions
1920
1921 # Cardnality and proper actor/actee, participant/participant event tests.
1922
1923 # Insert an event without a related parts row.
1924 prereq_events_no_parts := event_subtable_prereqs
1925 # Insert an event with 3 related parts rows.
1926 # A play event, with MOM, KID, and DAD; test events trigger.
1927 # Needs filter: (eid, participant)
1928 prereq_events_3_parts := parts_lots male5
1929 # Baboons must play with a single chimp.
1930 # A play event, with MOM, KID and a baboon; test events trigger.
1931 # Needs filter: (eid, participant)
1932 prereq_events_2_parts_baboon := parts_lots
1933 # Insert a parts row to give an event 3 related parts rows; test parts insert.
1934 # A play event, add DAD to existing MOM, KID for follow 1, 9:00.
1935 prereq_parts_3_parts := parts_lots male5
1936 # Delete a parts row to give an event 1 related parts rows; test parts delete.
1937 # Delete KID from the MOM/KID play event for follow 1, 9:00.
1938 prereq_parts_1_part := parts_lots
1939 # Changing a play event with MOM & KID to MOM baboon is legal, follow 1, 9:00.
1940 prereq_parts_1_part_baboon := parts_lots
1941 # A 'self' behavior can have only one parts row.
1942 # Try putting 2 parts rows into a eating event for SIB & KID
1943 # at 9:00 in follow 1.
1944 prereq_parts_2_self := parts_lots
1945 # A 'self' behavior cannot involve a baboon; update parts.
1946 # Take the MOM/baboon grooming event at 9:00 for follow 1 and change
1947 # MOM's part to 'self'.
1948 prereq_parts_self_baboon := parts_lots
1949 # A 'self' behavior cannot involve a baboon; insert events.
1950 # Insert a self play event for a sibling (SIB) at 9:00 for follow 1
1951 # and have it be with a baboon.
1952 prereq_events_self_baboon := parts_lots
1953 # Actors must have a corresponding actee; update of parts
1954 # Change mom (MOM) grooming infant (KID) at 9:00 in follow 1 to
1955 # two actors.
1956 prereq_parts_actor_actor := parts_lots
1957 # Actors must have a cooresponding actee: delete of parts
1958 # (Error says must have 2 participants, which satisfies the
1959 # test since adding a 2nd parts row will validate the new row.)
1960 # Delete infant in mom (MOM) grooming infant (KID) in follow1 at 9:00.
1961 prereq_parts_actor_actor_d := parts_lots
1962 #
1963 # Actors need not have a corresponding actee when a baboon is involved.
1964 # This case is tested for by parts_lots, which inserts just such a row.
1965 #
1966 # Actors must have a corresponding actee; update of parts
1967 # Change mom (MOM) grooming infant (KID) at 9:00 in follow 1 to
1968 # two actees.
1969 prereq_parts_actee_actee := parts_lots
1970 # Participants (P) must have a cooresponding participant: update of parts
1971 # Change infant to P in infant plays with mom (actor/actee) at 9:00
1972 # of follow 1.
1973 prereq_parts_participant_participant := parts_lots
1974 # Participant (P) must have a corresponding participant, unless
1975 # baboon is involved: update of parts
1976 # Have KID play with a baboon in a non-directed fashion at 9:00 in follow 1.
1977 prereq_parts_participant_baboon := parts_lots
1978
1979 # A non-social (self) interaction cannot happen to an individual at
1980 # the same time as a non-directed (participant) interaction.
1981 # Insert infant (KID) self-play into 9:00 of follow 1 when the
1982 # infant is already playing with the dad in a non-directed fashion.
1983 # (Note we don't really need the parts_lots.)
1984 prereq_self_participant_play := parts_lots infant_play_other_participant
1985
1986 # Directed behaviors are not allowed to be reciprocal.
1987 # (parts_lots already puts in reciprocal grooming behaviors for mom/kid
1988 # so we know the error message isn't spuriously triggered.)
1989 #
1990 # Update behaviors, set grooming to be non-reciprocal.
1991 # Needs filter: date, mother, time, participant, part
1992 prereq_behaviors_both_directions := parts_lots
1993 # Insert into parts, have mom (MOM) play with infant (KID) in a
1994 # directed fashion when the infant is already playing with the mom
1995 # in a directed fashion.
1996 # Needs filter: pid, participant, part
1997 prereq_parts_both_directions := parts_lots
1998 # Update events, change from grooming to play so that the mom (MOM)
1999 # is playing with the infant (KID) in a directed fashion when the infant
2000 # is already playing with the mom in a directed fashion.
2001 # At 9:00 in follow 1.
2002 # Needs filter: pid (except pid is not displayed), participant, part
2003 prereq_events_both_directions := parts_lots
2004
2005 # Behaviors restricted/exclusive.
2006 #
2007 # The really safe thing to do, which isn't done, is before
2008 # testing mom-or-not exclusive/restricted to update the behaviors
2009 # table so that the not-or-mom columns are all false. This would
2010 # check for using the wrong column in the trigger code.
2011 #
2012 # behaviors
2013 # Update behaviors so grooming is restricted.
2014 # Needs filter: date, mother, time, baboon, participant, part
2015 prereq_behaviors_restricted := parts_lots
2016 # Update behaviors so 'other' is excluded.
2017 # Needs filter: date, mother, time, baboon, participant, part
2018 prereq_behaviors_exclusive := parts_lots_infant_resting \
2019 parts_lots_infant_other
2020 # Update behaviors so grooming is mom_restricted.
2021 # Needs filter: date, mother, time, baboon, participant, part
2022 prereq_behaviors_mom_restricted := parts_lots
2023 # Update behaviors so "other" is mom exclusive.
2024 # Needs filter: date, mother, time, baboon, participant, part
2025 prereq_behaviors_mom_exclusive := parts_lots_mom_resting \
2026 parts_lots_mom_other
2027 # Restricted/Exclusive conditions do not apply when everything is uncertain.
2028 # (Note, not testing restricted/exclusive regards moms.)
2029 # Make every event uncertain, then change grooming to restricted.
2030 prereq_behaviors_er_uncertain := parts_lots
2031 # Restricted/exclusive conditions do not apply to actees.
2032 # (Note, not testing regards infant/sib.)
2033 # Make play restricted.
2034 prereq_behaviors_er_actee := parts_lots_infant_mom_play \
2035 parts_lots_mom_infant_grooming
2036 #
2037 # parts
2038 # Insert parts, of restricted behavior.
2039 # Insert a infant resting behavior when there's other exclusive behaviors
2040 # already.
2041 prereq_parts_restricted := parts_lots positions resting_postures
2042 # Insert parts, an exclusive behavior.
2043 # Insert an infant eating behavior when there's an other (resting)
2044 # restricted behavior.
2045 prereq_parts_exclusive := parts_lots_infant_resting foodkinds foodparts
2046 # Insert parts, a mom restricted behavior.
2047 # Insert a mom resting behavior when there's other exclusive behaviors.
2048 prereq_parts_mom_restricted := parts_lots positions resting_postures
2049 # Insert parts, a mom exclusive behavior.
2050 # Insert a mom eating beahvior when there's an other (resting)
2051 # restricted behavior.
2052 prereq_parts_mom_exclusive := parts_lots_mom_resting foodkinds foodparts
2053 # Restricted/Exclusive conditions do not apply when everything is uncertain.
2054 # (Note, not testing restricted/exclusive regards moms.)
2055 # Make every event uncertain, then add an uncertain resting event
2056 # to follow 1 at 9:00.
2057 prereq_parts_er_uncertain := parts_lots resting_postures positions
2058 # Restricted/exclusive conditions do not apply to actees.
2059 # (Note, not testing regards infant/sib.)
2060 # Insert mom resting when there's infant grooming mom events.
2061 prereq_parts_er_actee := parts_lots_infant_mom_grooming \
2062 resting_postures positions
2063 #
2064 # events
2065 # Update events changing behavior from eating to resting (a restricted
2066 # behavior) when there are already exclusive behaviors
2067 # for infant (KID) at 9:00 in follow 1.
2068 prereq_events_restricted := parts_lots positions resting_postures
2069 # Update events changing behavior from other to eating (an exclusive
2070 # behavior) when there is already a resticted behavior (resting)
2071 # for infant (KID) at 9:00 in follow 1
2072 prereq_events_exclusive := parts_lots_infant_resting parts_lots_infant_other \
2073 foodparts foodkinds
2074 # Update events changing mom behavior from eating to resting (a restricted
2075 # behavior) when there are already mom exclusive behaviors
2076 # for mom (MOM) at 9:00 in follow 1.
2077 prereq_events_mom_restricted := parts_lots positions resting_postures
2078 # Update events changing mom behavior from other to eating (an exclusive
2079 # behavior) when there is already a mom resticted behavior (resting)
2080 # for mom (MOM) at 9:00 in follow 1
2081 prereq_events_mom_exclusive := parts_lots_mom_resting \
2082 parts_lots_mom_other foodparts foodkinds
2083 # Restricted/Exclusive conditions do not apply when everything is uncertain.
2084 # (Note, not testing restricted/exclusive regards moms.)
2085 # Make every event uncertain, then update events changing eating to
2086 # resting (a restricted behavior) for infant (KID) in
2087 # follow 1 at 9:00.
2088 prereq_events_er_uncertain := parts_lots resting_postures positions
2089 # Restricted/exclusive conditions do not apply to actees.
2090 # (Note, not testing regards infant/sib.)
2091 # Update events changing mom behavior from eating to resting (a restricted
2092 # behavior) when there are already mom as an actee exclusive behaviors
2093 # for mom (MOM) at 9:00 in follow 1.
2094 prereq_events_er_actee := parts_lots_infant_mom_grooming \
2095 parts_lots_mom_eating positions resting_postures
2096
2097 #
2098 # Views
2099 #
2100
2101 # focal_follows
2102
2103 # Test insert into focalfollows, with sibling
2104 # Also test that inserting returns the inserted row.
2105 prereq_ff_insert := demography sib followroles
2106 # A follow must have an interval to successfully commit.
2107 prereq_ff_interval := ff_insert sheets
2108 # Prove that the rows actually went in.
2109 prereq_ff_insert_out := ff_interval
2110 # Test insert into focalfollows, without sibling
2111 prereq_ff_insert1 := demography sib followroles
2112 # A follow must have an interval to successfully commit.
2113 # (Same as ff_interval, with different prereq.)
2114 prereq_ff_interval1 := ff_insert1 sheets
2115 # Prove that the rows actually went in.
2116 # (Same as ff_insert_out, with different prereq.)
2117 prereq_ff_insert1_out := ff_interval1
2118
2119 # Test update of focal_follows, updating date.
2120 prereq_ffu_date := ff_interval
2121 # (Code is the same as the ff_insert_out code, results differ.)
2122 prereq_ffu_date_out := ffu_date
2123 # Test update of focal_follows, updating mom.
2124 prereq_female4_adopt := demography female4
2125 prereq_ffu_mom := ff_interval1 female4_adopt
2126 # (Code is the same as the ff_insert_out code, results differ.)
2127 prereq_ffu_mom_out := ffu_mom
2128 # Test update of focal_follows, inserting sib.
2129 prereq_ffu_newsib := ff_interval1
2130 # (Code is the same as the ff_insert_out code, results differ.)
2131 prereq_ffu_newsib_out := ffu_newsib
2132 # Test update of focal_follows, deleting sib.
2133 prereq_ffud := ff_interval
2134 # (Code is the same as the ff_insert_out code, results differ.)
2135 prereq_ffud_out := ffud
2136
2137 # Test delete of focal_follows.
2138 prereq_ff_delete := ff_interval
2139 prereq_ff_delete_out := ff_delete
2140
2141 # Test display of twins.
2142 # (Code is the same as the ff_insert_out code, results differ.)
2143 prereq_ff_twins_out := followparts_twins
2144
2145
2146 # follow_intervals
2147
2148 # Simple test of view output
2149 prereq_fi_out := intervals
2150
2151 # Insert with followid (also inserts new sheet and new fieldfollow)
2152 # Test also checks that INSERT ... RETURNING returns what's in the db.
2153 prereq_fi_i_followid := ff_insert followtypes people
2154 # Insert with date/mom/infant
2155 prereq_fi_i_dmi := ff_insert followtypes people
2156 # Insert with existing sheet
2157 ## Insert with sheetid
2158 prereq_fi_i_sheetid := ff_insert sheets
2159 ## Insert with page number
2160 prereq_fi_i_page := ff_insert sheets
2161 # Insert with existing fieldfollow
2162 ## Insert with ffid
2163 prereq_fi_i_ffid := ff_insert fieldfollows1
2164 ## Insert with collector (This inserts a 2nd event.)
2165 prereq_fi_i_collector := fi_i_followid
2166 # Update the interval time
2167 prereq_fi_u_time := fi_i_dmi
2168 # Delete an interval.
2169 prereq_fi_d := fi_i_collector
2170
2171 # Test of not being able to update a non-updatable column.
2172 # Try to update the date.
2173 prereq_fi_error := fi_i_dmi
2174
2175 # family_events
2176
2177 # Simple test of family_events output
2178 # (Should probably have a different prerequsite with fewer rows.)
2179 prereq_fe_out := parts_lots
2180
2181 # Insert by intid
2182 # Insert a single mom self-grooming event.
2183 # Also test that INSERT ... RETURNING ... returns what's in the db.
2184 prereq_fe_i_intid := fi_i_followid behaviors
2185 # Insert by date, mom, infant, time.
2186 prereq_fe_i_dmit := fi_i_followid behaviors
2187 # Insert by followid, time.
2188 prereq_fe_i_ft := fi_i_followid behaviors
2189 # Insert by date, mom, infant, time when there's lots of parts.
2190 # Add a mom self-grooming to 9:00 follow1.
2191 prereq_fe_i_lots := parts_lots
2192 # Update change behavior.
2193 # Change self self-grooming to self-other for mom.
2194 prereq_fe_u_behavior := fe_i_intid
2195 # Update change participant
2196 ## Change chimpid in place
2197 ## Change MOM to KID
2198 prereq_fe_u_chimpid := fe_i_intid
2199 ## Delete old parts row add new.
2200 ## Also tests for returning of db content.
2201 prereq_fe_u_oldtonew := fe_i_intid
2202 # Delete
2203 prereq_fe_d := fe_i_intid
2204
2205 # Datasheet_events
2206
2207 # Simple test of datasheet_events output
2208 # (Should probably have a different prerequsite with fewer rows.)
2209 prereq_de_out := parts_lots
2210
2211 # Insert by intid
2212 # Insert a single mom self-grooming event.
2213 # Also test that INSERT ... RETURNING ... returns what's in the db.
2214 prereq_de_i_intid := fi_i_followid behaviors
2215 # Insert a mom eating event, using an intid.
2216 prereq_de_i_eats := fi_i_followid behaviors foodparts foodkinds
2217 # Insert a 2nd mom eating food for an existing eating event.
2218 prereq_de_i_eats2 := de_i_eats
2219 # Insert a mom fishing event, using an intid.
2220 prereq_de_i_fished := fi_i_followid behaviors \
2221 foodparts foodkinds fishing_results
2222 # Insert a mom play event, using an intid.
2223 prereq_de_i_plays := fi_i_followid behaviors play_types
2224 # Insert a 2nd mom play type for an existing play event.
2225 prereq_de_i_plays2 := de_i_plays
2226 # Insert a mom rest event, using an intid.
2227 prereq_de_i_rests := fi_i_followid behaviors resting_postures positions
2228 # Insert an infant ride event, using an intid.
2229 prereq_de_i_rides := fi_i_followid behaviors riding_postures
2230 # Insert a mom vocalization event, using an intid.
2231 prereq_de_i_vocs := fi_i_followid behaviors vocalizations
2232 # Insert a second vocalization for an existing vocalization event.
2233 prereq_de_i_vocs2 := de_i_vocs
2234 # Insert by date, mom, infant, time when there's lots of parts.
2235 # Add a mom food to eating event at 9:00 follow1.
2236 prereq_de_i_lots := parts_lots
2237 # Update change behavior.
2238 # Change self self-grooming to self-other for mom.
2239 # Also tests that update returns what's in the db.
2240 prereq_de_u_behavior := de_i_intid
2241 # Change a mom's vocalization code from HOO to GR.
2242 prereq_de_u_vocs := de_i_vocs
2243 # Delete one of a mom's two vocalizations.
2244 prereq_de_u_vocs2 := de_i_vocs2
2245 # Change a mom's eating foodpart and foodkind from M,B to V,L
2246 prereq_de_u_eats := de_i_eats
2247 # Delete one of a mom's 2 eaten foods.
2248 prereq_de_u_eats2 := de_i_eats2
2249 # Change a mom's fishing foodkind from B to F
2250 prereq_de_u_fished := de_i_fished
2251 # Change a mom's play code from OP to TP
2252 prereq_de_u_plays := de_i_plays
2253 # Delete one of a mom's 2 play types
2254 prereq_de_u_plays2 := de_i_plays2
2255 # Change a mom's rest code
2256 prereq_de_u_rests := de_i_rests
2257 # Change an infant's ride code
2258 prereq_de_u_rides := de_i_rides
2259 # Update to insert eating foodpart
2260 prereq_de_u_eats_i := de_i_intid foodkinds foodparts
2261 # Update to insert fishing foodtype
2262 prereq_de_u_fished_i := de_i_intid foodkinds foodparts fishing_results
2263 # Update to insert resting posture
2264 prereq_de_u_rests_i := de_i_intid positions resting_postures
2265 # Update to insert riding posture
2266 # (needs to use a infant grooming mom as a starting point)
2267 prereq_de_u_rides_i := parts_lots riding_postures
2268 # Update to insert play type
2269 prereq_de_u_plays_i := de_i_intid play_types
2270 # Update to insert vocalization
2271 prereq_de_u_vocs_i := de_i_intid vocalizations
2272 # Delete
2273 prereq_de_d := de_i_intid
2274
2275 # family_dists
2276
2277 # Simple test of family_dists output
2278 # (Should probably have a different prerequsite with fewer rows.)
2279 prereq_fd_out := distanceparts_lots
2280
2281 # Insert by intid
2282 # Insert a single mom-infant distance, using intid.
2283 # Also tests to be sure INSERT ... RETURNING returns what's in the db.
2284 prereq_fd_i_intid := fi_i_followid distancecodes
2285 # Insert by date, mom, infant, time.
2286 prereq_fd_i_dmit := fi_i_followid distancecodes
2287 # Insert by followid, time.
2288 prereq_fd_i_ft := fi_i_followid distancecodes
2289 # Insert by followid and time, a mom and a sib.
2290 prereq_fd_i_ft_mom_sib := fi_i_followid distancecodes
2291 # Update change distance.
2292 # Change mom/infant distance.
2293 prereq_fd_u_distance := fd_i_intid
2294 # Update change participant
2295 ## Change chimpid in place
2296 ## Change KID to SIB
2297 prereq_fd_u_chimpid := fd_i_intid
2298 ## Delete old distanceparts row add new.
2299 ## Also tests to see that db content is returned properly.
2300 prereq_fd_u_oldtonew := fd_i_intid
2301 # Delete
2302 prereq_fd_d := distanceparts_lots
2303 # Insert by date, mom, infant, time when there's lots of parts.
2304 # Add a mom self-grooming to 9:00 follow1.
2305 prereq_fd_i_lots := fd_d
2306
2307 #
2308 # Warning system
2309 #
2310
2311 # integrity_queries
2312 # Normal integrity query (warns on birthdates before 1960)
2313 prereq_iq_i := iqtypes
2314 # A integrity_query.iqname of an empty string is illegal.
2315 prereq_iq_i_notempty := iqtypes
2316 # A integrity_query.iqname cannot contain a space.
2317 prereq_iq_i_nospace := iqtypes
2318 # A integrity_query.iqname cannot change.
2319 prereq_iq_u_iqname := iq_i
2320 # An integrity query cannot be run most recently before it was run first.
2321 prereq_iq_u_last_early := iq_i
2322
2323 # integrity_warnings
2324 prereq_iw_i := iq_i
2325 # An integrity warning cannot be seen most recently before it was first seen.
2326 prereq_iw_u_last_early := iw_i
2327 # An integrity warning cannot be resolved before it was first seen.
2328 prereq_iw_u_resolved_early := iw_i
2329 # An integrity warning cannot be deferred to a time before it was first seen.
2330 prereq_iw_u_deferred_early := iw_i
2331
2332 # Combination tests
2333 # Warnings can be resolved.
2334 prereq_iw_u_resolve := iw_i
2335 # Errors can be made into warnings when there's no resolution
2336 # (Same as iq_resolve_errors, only with different pre-requsites.)
2337 prereq_iq_u_make_error := iw_i
2338 # Warnings cannot be resolved, update of integrity_queries
2339 prereq_iq_u_resolve_errors := iw_u_resolve
2340 # Warnings cannot be resolved, update of integrity_warnings
2341 # (Same as iw_u_resolve, only with different pre-requsites.)
2342 prereq_iw_u_resolve_errors := iq_u_make_error
2343
2344 # Tests of the functions
2345 # Query supplied to command fails
2346 # riq_badarg (No prerequsite)
2347 # Query supplied to command returns invalid iqname
2348 prereq_riq_bad_iqname := iq_i
2349 # Query saved in integrity_queries fails
2350 prereq_iq_i_bad := iqtypes
2351 prereq_riq_bad_squery := iq_i_bad
2352 # Running 1 query works and finds the right results
2353 prereq_riq_1_results := iq_i demography
2354 # Insert an additional saved query
2355 prereq_iq_i2 := iqtypes
2356 # Running 2 queries work
2357 # (This is the same code riq_1_results, only with different pre-requsites.)
2358 prereq_riq_2_results := iq_i iq_i2 demography
2359 # Running 2 queries updates result timestamps
2360 prereq_riq_every_rtimestamp := riq_2_results
2361 # Running query updates saved query timestamp
2362 prereq_riq_every_stimestamp := riq_2_results
2363 # Running 1 query after running 2 that find problems updates only the
2364 # saved query timestamp for the 2nd run.
2365 prereq_riq_one_stimestamp := riq_2_results
2366 # Resolved warnings are not returned
2367 prereq_riq_resolved := riq_2_results
2368 # Warnings deferred to the future are not returned.
2369 prereq_riq_future := riq_2_results
2370 # Warnings deferred to the past are returned.
2371 prereq_riq_past := riq_2_results
2372 # When problem goes away the integrity_warnings row is removed
2373 prereq_riq_no_problem := riq_1_results
2374
2375 # Prerequesites that exist only to give names to prerequsite collections.
2376 # (Targets can have any name.
2377 # These targets must be added to VIRTUAL_PREREQS.)
2378 VIRTUAL_PREREQS := \
2379 adoptions_prereqs \
2380 follow_prereqs \
2381 intervals_prereqs \
2382 followpart_basic_prereqs \
2383 followpart_prereqs \
2384 followparts_amom_prereqs \
2385 intervals_lots_day1 \
2386 event_subtable_prereqs \
2387 parts_mostly_prereqs \
2388 five_sheets
2389
2390 adoptions_prereqs := male3 family2
2391 follow_prereqs := people
2392 intervals_prereqs := sheets_second follows2_data follows3_data
2393 followpart_basic_prereqs := followroles follow_prereqs
2394 followpart_prereqs := followpart_basic_prereqs demography family2
2395 followparts_amom_prereqs := followparts13 adoptions3 follows1_data \
2396 follows4_data intervals_fourth_follow \
2397 intervals_third_follow intervals_first_follow \
2398 followparts2 intervals
2399 intervals_lots_day1 := intervals_lots_follow1 intervals_lots_follow2
2400 event_subtable_prereqs := intervals_first_follow followparts1 behaviors
2401 parts_mostly_prereqs := \
2402 parts_lots_infant_eating \
2403 parts_lots_infant_mom_grooming \
2404 parts_lots_infant_nursing \
2405 parts_lots_infant_sib_grooming \
2406 parts_lots_mom_baboon_grooming \
2407 parts_lots_mom_dad_grooming \
2408 parts_lots_mom_eating \
2409 parts_lots_mom_infant_grooming \
2410 parts_lots_mom_ma5_play_nondirected \
2411 parts_lots_mom_unknown_grooming \
2412 parts_lots_mom_unknown_grooming2 \
2413 # Get all sheets up to 5.
2414 five_sheets := sheets_fourth sheets_fifth
2415
2416 ###############
2417 # Internals
2418
2419 # 'commit' need not have a prerequisite, but then it won't succeed
2420 # should it be run as an independent test.
2421 prereq_commit := begin