local F=game:GetService("\082\101\112\108\105\099\097\116\101\100\083\116\111\114\097\103\101")local I=require(F.Packages.Dex.Observables.IntSpring)local s=require(F.Packages.Dex.Observables.State)return function()local function F()local F=os.clock()while os.clock()==F do end end it("\099\111\110\115\116\114\117\099\116\115 \073\110\116\083\112\114\105\110\103 \119\104\105\099\104 \101\097\115\101\115 \116\111 \116\097\114\103\101\116 \119\047 \105\110\116 \114\111\117\110\100\105\110\103",function()local v=s.new(0)local L=I.new(v);(expect(L)).to.be.ok()v:Set(1.1)F();(expect(L:Current())).to.equal(0);(expect(L:CurrentTarget())).to.equal(1)v:Set(2.6)F();(expect(L:Current())).to.equal(0);(expect(L:CurrentTarget())).to.equal(3)v:Set(-3.4)F();(expect(L:Current())).to.equal(0);(expect(L:CurrentTarget())).to.equal(-3)end)it("\115\104\111\117\108\100 \116\104\114\111\119 \097\110 \101\114\114\111\114 \102\111\114 \117\110\115\117\112\112\111\114\116\101\100 \100\097\116\097 \116\121\112\101\115",function()local F=s.new(true);(expect(function()I.new(F)end)).to.throw("\068\097\116\097 \116\121\112\101 \'\098\111\111\108\101\097\110\' \099\097\110\110\111\116 \098\101 \101\097\115\101\100 \117\115\105\110\103 \073\110\116\083\112\114\105\110\103")end)end
--!strict
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local IntSpring = require(ReplicatedStorage.Packages.Dex.Observables.IntSpring)
local State = require(ReplicatedStorage.Packages.Dex.Observables.State)
return function()
    local function waitUntilClockChange()
        local start = os.clock()
        -- selene: allow(empty_loop)
        while os.clock() == start do end
    end

    it("constructs IntSpring which eases to target w/ int rounding", function()
        local target = State.new(0)
        local easingObservable = IntSpring.new(target)
        expect(easingObservable).to.be.ok()

        target:Set(1.1)
        waitUntilClockChange()
        expect(easingObservable:Current()).to.equal(0)
        expect(easingObservable:CurrentTarget()).to.equal(1)

        target:Set(2.6)
        waitUntilClockChange()
        expect(easingObservable:Current()).to.equal(0)
        expect(easingObservable:CurrentTarget()).to.equal(3)

        target:Set(-3.4)
        waitUntilClockChange()
        expect(easingObservable:Current()).to.equal(0)
        expect(easingObservable:CurrentTarget()).to.equal(-3)
    end)

    it("should throw an error for unsupported data types", function()
        local target = State.new(true)
        expect(function()
            IntSpring.new(target)
        end).to.throw("Data type 'boolean' cannot be eased using IntSpring")
    end)
end
