Exemplo n.º 1
0
    private void Test(int length, FillArrayType type)
    {
        // setup:
        var data = new int[length];

        Utils.FillArray(data, type);

        // when:
        var result = reducer.Reduce(data);

        // then:
        Assert.AreEqual(result, Utils.Reduce(data));
    }
    // Update is called once per frame
    private void Update()
    {
        if (!Input.GetKeyDown(KeyCode.Return))
        {
            return;
        }

        IntArray(ref data, size, type, maxValue, constValue);
        if (printArray)
        {
            LogUtils.PrintArray(data, "In: ");
        }

        var sw     = Stopwatch.StartNew();
        var reduce = reduser.Reduce(data);

        sw.Stop();

        Debug.Log("Reduce: gpu=" + reduce + " " + sw.ElapsedMilliseconds + "ms");
        if (printArray)
        {
            Debug.Log("Reduce: cpu=" + Utils.Reduce(data));
        }
    }