MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / TestSyncDataCVEqual

Function TestSyncDataCVEqual

db/crud_test.go:2230–2284  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

2228}
2229
2230func TestSyncDataCVEqual(t *testing.T) {
2231 testCases := []struct {
2232 name string
2233 syncData SyncData
2234 cvSourceID string
2235 cvValue uint64
2236 cvEqual bool
2237 }{
2238 {
2239 name: "syncData CV matches",
2240 syncData: SyncData{
2241 RevAndVersion: channels.RevAndVersion{
2242 CurrentSource: "testSourceID",
2243 CurrentVersion: "0x0100000000000000",
2244 },
2245 },
2246 cvSourceID: "testSourceID",
2247 cvValue: 1,
2248 cvEqual: true,
2249 },
2250 {
2251 name: "syncData sourceID mismatch",
2252 syncData: SyncData{
2253 RevAndVersion: channels.RevAndVersion{
2254 CurrentSource: "testSourceID",
2255 CurrentVersion: "0x1",
2256 },
2257 },
2258 cvSourceID: "testSourceID2",
2259 cvValue: 1,
2260 cvEqual: false,
2261 },
2262 {
2263 name: "syncData sourceID mismatch",
2264 syncData: SyncData{
2265 RevAndVersion: channels.RevAndVersion{
2266 CurrentSource: "testSourceID",
2267 CurrentVersion: "0x2",
2268 },
2269 },
2270 cvSourceID: "testSourceID",
2271 cvValue: 1,
2272 cvEqual: false,
2273 },
2274 }
2275 for _, testCase := range testCases {
2276 t.Run(testCase.name, func(t *testing.T) {
2277 cv := Version{
2278 SourceID: testCase.cvSourceID,
2279 Value: testCase.cvValue,
2280 }
2281 require.Equal(t, testCase.cvEqual, testCase.syncData.CVEqual(cv))
2282 })
2283 }
2284}

Callers

nothing calls this directly

Calls 3

CVEqualMethod · 0.80
RunMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected