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

ArkScript-lang / Ark / 16727698334

04 Aug 2025 03:41PM UTC coverage: 86.247% (-0.5%) from 86.737%
16727698334

Pull #564

github

web-flow
Merge 1f295b14b into 06fb44ced
Pull Request #564: Adding new dictionary data type

111 of 175 new or added lines in 14 files covered. (63.43%)

2 existing lines in 2 files now uncovered.

7431 of 8616 relevant lines covered (86.25%)

126711.4 hits per line

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

70.0
/src/arkreactor/VM/Value/Dict.cpp
1
#include <Ark/VM/Value/Dict.hpp>
2

3
#include <Ark/VM/VM.hpp>
4

5
#include <ranges>
6

7
namespace Ark::internal
8
{
9
    void Dict::set(const Value& key, const Value& value)
25✔
10
    {
25✔
11
        m_dict.insert_or_assign(key, value);
25✔
12
    }
25✔
13

14
    const Value& Dict::get(const Value& key)
73✔
15
    {
73✔
16
        if (const auto it = m_dict.find(key); it != m_dict.end())
144✔
17
            return it->second;
71✔
18
        return Nil;
2✔
19
    }
73✔
20

21
    bool Dict::contains(const Value& key) const
12✔
22
    {
12✔
23
        return m_dict.contains(key);
12✔
24
    }
25

26
    void Dict::remove(const Value& key)
2✔
27
    {
2✔
28
        m_dict.erase(key);
2✔
29
    }
2✔
30

31
    std::vector<Value> Dict::keys()
19✔
32
    {
19✔
33
        std::vector<Value> keys;
19✔
34
        keys.reserve(m_dict.size());
19✔
35

36
        for (auto&& key : std::ranges::views::keys(m_dict))
60✔
37
            keys.push_back(key);
41✔
38
        return keys;
19✔
39
    }
19✔
40

41
    std::size_t Dict::size() const
21✔
42
    {
21✔
43
        return m_dict.size();
21✔
44
    }
45

NEW
46
    std::string Dict::toString(VM& vm) const
×
NEW
47
    {
×
NEW
48
        std::string out = "{";
×
49

NEW
50
        std::size_t i = 0;
×
NEW
51
        for (const auto& [key, value] : m_dict)
×
52
        {
NEW
53
            out += key.toString(vm) + ": " + value.toString(vm);
×
54

NEW
55
            if (i + 1 != m_dict.size())
×
NEW
56
                out += ", ";
×
NEW
57
            ++i;
×
NEW
58
        }
×
59

NEW
60
        return out + "}";
×
NEW
61
    }
×
62
}
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

© 2026 Coveralls, Inc