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