コード例 #1
0
    public static void TestOperationScale()
    {
        JsonArray lim = new JsonArray().Add("abc").Add("def");

        JsonObject obj1 = new JsonObject().Add("abc", 123).Add("def", 4).Add("ghi", 2);
        JsonObject obj2 = new JsonObject().Add("abc", 2).Add("ghi", 2);
        JsonObject result = obj1.Scale(obj2);
        JsonObject limResult = obj1.Scale(obj2, lim);

        result.Get<float>("abc").ShouldBe(246);
        result.Get<float>("def").ShouldBe(0);
        result.ContainsKey("ghi").ShouldBe(true);

        limResult.Get<float>("abc").ShouldBe(246);
        limResult.Get<float>("def").ShouldBe(0);
        limResult.ContainsKey("ghi").ShouldBe(false);
    }