Exemplo n.º 1
0
        public void TestGcdTickSize()
        {
            PbTickCodec codec = new PbTickCodec();

            Assert.AreEqual(0.00001, codec.gcd());
            Assert.AreEqual(0.3, codec.gcd(100.3f - 100.0f));
            Assert.AreEqual(0.2, codec.gcd(100.3f - 100.1f));
            Assert.AreEqual(0.1, codec.gcd(100.3f - 100.0f, 100.2f - 100.0f));
            Assert.AreEqual(0.1, codec.gcd(100.3f - 100.0f, 100.2f - 100.0f, 100.1f - 100.0f));
            Assert.AreEqual(0.05, codec.gcd(100.3f - 100.0f, 100.2f - 100.0f, 100.1f - 100.0f, 100.1f - 100.05f));

            Assert.AreEqual(0.1, codec.gcd(100.0f - 100.3f, 100.0f - 100.2f));
            Assert.AreEqual(0.05, codec.gcd(100.0f - 100.3f, 100.0f - 100.2f, 100.0f - 100.1f, 100.05f - 100.1f));
            Assert.AreEqual(10, codec.gcd(1000, 41430));
        }