1// tdiffer.cpp -- Regression test program, differential commit tests 2// $Id: tdiffer.cpp 1230 2007-03-09 15:58:53Z jcw $ 3// This is part of Metakit, the homepage is http://www.equi4.com/metakit.html 4 5#include "regress.h" 6 7void TestDiffer() { 8 B(d01, Commit aside, 0)W(d01a); 9 W(d01b); 10 { 11 c4_IntProp p1("p1"); 12 { 13 c4_Storage s1("d01a", 1); 14 A(s1.Strategy().FileSize() == 0); 15 c4_View v1 = s1.GetAs("a[p1:I]"); 16 v1.Add(p1[123]); 17 s1.Commit(); 18 } 19 { 20 c4_Storage s1("d01a", 0); 21 c4_Storage s2("d01b", 1); 22 s1.SetAside(s2); 23 c4_View v1 = s1.View("a"); 24 A(v1.GetSize() == 1); 25 A(p1(v1[0]) == 123); 26 v1.Add(p1[456]); 27 A(v1.GetSize() == 2); 28 A(p1(v1[0]) == 123); 29 A(p1(v1[1]) == 456); 30 s1.Commit(); 31 A(v1.GetSize() == 2); 32 A(p1(v1[0]) == 123); 33 A(p1(v1[1]) == 456); 34 s2.Commit(); 35 A(v1.GetSize() == 2); 36 A(p1(v1[0]) == 123); 37 A(p1(v1[1]) == 456); 38 } 39 { 40 c4_Storage s1("d01a", 0); 41 c4_View v1 = s1.View("a"); 42 A(v1.GetSize() == 1); 43 A(p1(v1[0]) == 123); 44 c4_Storage s2("d01b", 0); 45 s1.SetAside(s2); 46 c4_View v2 = s1.View("a"); 47 A(v2.GetSize() == 2); 48 A(p1(v2[0]) == 123); 49 A(p1(v2[1]) == 456); 50 } 51 } 52 D(d01a); 53 D(d01b); 54 R(d01a); 55 R(d01b); 56 E; 57} 58