~stolowski/unity-scopes-shell/settings-harness-fixes

« back to all changes in this revision

Viewing changes to src/scope-harness/matcher/settings-option-matcher.cpp

  • Committer: Pawel Stolowski
  • Date: 2015-05-18 15:02:40 UTC
  • Revision ID: pawel.stolowski@canonical.com-20150518150240-02xqzwooi9tsoix3
Cleanups

Show diffs side-by-side

added added

removed removed

Lines of Context:
54
54
    }
55
55
}
56
56
 
 
57
//
 
58
// Convert scopes::Variant of type int/int64_t/double
 
59
// to double.
57
60
static double number_to_double(const sc::Variant v)
58
61
{
59
62
    auto tp = v.which();
78
81
{
79
82
    if (!(actualValue == expectedValue))
80
83
    {
 
84
        // the values may be actually the same but of different type; also doubles should be compared
 
85
        // with some fuzziness.
81
86
        try
82
87
        {
83
88
            if (std::abs(number_to_double(actualValue) - number_to_double(expectedValue)) < 0.0000000001f)