• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

realm / realm-core / nicola.cabiddu_1042

27 Sep 2023 06:04PM UTC coverage: 91.085% (-1.8%) from 92.915%
nicola.cabiddu_1042

Pull #6766

Evergreen

nicola-cab
Fix logic for dictionaries
Pull Request #6766: Client Reset for collections in mixed / nested collections

97276 of 178892 branches covered (0.0%)

1994 of 2029 new or added lines in 7 files covered. (98.28%)

4556 existing lines in 112 files now uncovered.

237059 of 260260 relevant lines covered (91.09%)

6321099.55 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

66.67
/src/realm/impl/transact_log.cpp
1
/*************************************************************************
2
 *
3
 * Copyright 2016 Realm Inc.
4
 *
5
 * Licensed under the Apache License, Version 2.0 (the "License");
6
 * you may not use this file except in compliance with the License.
7
 * You may obtain a copy of the License at
8
 *
9
 * http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 *
17
 **************************************************************************/
18

19
#include <realm/impl/transact_log.hpp>
20
#include <realm/util/overload.hpp>
21

22
namespace realm::_impl {
23

24

25
bool TransactLogEncoder::select_table(TableKey key)
26
{
1,399,548✔
27
    size_t levels = 0;
1,399,548✔
28
    append_simple_instr(instr_SelectTable, levels, key.value); // Throws
1,399,548✔
29
    return true;
1,399,548✔
30
}
1,399,548✔
31

32
bool TransactLogEncoder::select_collection(ColKey col_key, ObjKey key, const StablePath& path)
33
{
277,959✔
34
    auto path_size = path.size();
277,959✔
35
    if (path_size > 1) {
277,959✔
36
        append_simple_instr(instr_SelectCollectionByPath, col_key, key.value);
1,668✔
37
        append_simple_instr(path_size - 1);
1,668✔
38

834✔
39
        for (size_t n = 1; n < path_size; n++) {
3,378✔
40
            append_simple_instr(path[n].get_salt());
1,710✔
41
        }
1,710✔
42
    }
1,668✔
43
    else {
276,291✔
44
        append_simple_instr(instr_SelectCollection, col_key, key.value); // Throws
276,291✔
45
    }
276,291✔
46
    return true;
277,959✔
47
}
277,959✔
48

49
void TransactLogEncoder::encode_string(StringData string)
UNCOV
50
{
×
UNCOV
51
    size_t max_required_bytes = max_enc_bytes_per_int + string.size();
×
UNCOV
52
    char* ptr = reserve(max_required_bytes); // Throws
×
UNCOV
53
    ptr = encode(ptr, size_t(string.size()));
×
UNCOV
54
    ptr = std::copy(string.data(), string.data() + string.size(), ptr);
×
UNCOV
55
    advance(ptr);
×
UNCOV
56
}
×
57

58
REALM_NORETURN
59
void TransactLogParser::parser_error() const
UNCOV
60
{
×
UNCOV
61
    throw Exception(ErrorCodes::BadChangeset, "Bad transaction log");
×
UNCOV
62
}
×
63

64
} // namespace realm::_impl
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc