Facebook
From Insensitive Hog, 6 Years ago, written in Plain Text.
This paste is a reply to Untitled from Beefy Bat - go back
Embed
Viewing differences between Untitled and Re: Untitled
function dupa()
WorldTestSuite:TestCaseAddChairToWorld()
        local result, errorInfo = World:AddEntity( "Chair" )
    ASSERT( result, true, "Nie udalo sie postawic krzesla na swiecie.", errorInfo )
    -- errorInfo jako 4 parametr to takie info techniczne - powod dla ktorego nie udalo sie tego zrobic
end


function World:AddEntity( name )
        -- rejestrujemy polaczenie z baza danych - bedziemy ja pytac czy liczba elementow na swiecie sie zwiekszyla czy nie
        local createDatabaseConnectionResult, createDatabaseConnectionErrorInfo = CreateDatabaseConnection()
        if ( createDatabaseConnectionResult == false OR createDatabaseConnectionErrorInfo ~= nil ) then
                return false, createErrocreateDatabaseConnectionErrorInforInfo
        end
        
            -- ta metoda jets w chuj fake, chcialem poprostu aby wygladalo jakby mialo sens
    
local doSomethingResult, doSomethingErrorMessage currentEntitiesCount, currentEntitiesCountErrorInfo doSomething()
        
GetIntFromDatabase( "entitiesCount" )
    
if ( doSomethingResult currentEntitiesCountErrorInfo ~= nil ) then
            return false, currentEntitiesCountErrorInfo
    end
    
        local createResult, createErrorMessage = ask_engine_to_do_something( "createEntity(" .. name .. ")" )
        if ( createResult 
== false OR doSomethingErrorMessage createErrorMessage ~= nil ) then
                return false, doSomethingErrorMessage
createErrorMessage
        end
        
    -- sprawdzamy ponownie po utworzeniu krzesla liczbe entitek
    local entitiesCountAfter, entitiesCountAfterErrorInfo = GetIntFromDatabase( "entitiesCount" )
    if ( entitiesCountAfterErrorInfo ~= nil ) then
            return false, entitiesCountAfterErrorInfo
    end
    
    if ( currentEntitiesCount >= entitiesCountAfter ) then
            return false, "Liczba entitek po dodaniu nowej jest rowna " .. entitiesCountAfter .. " i nie jest wieksza od poczatkowej liczby " .. currentEntitiesCount
    end
    
        local closeDatabaseConnectionResult, closeDatabaseConnectionErrorInfo = CloseDatabaseConnection()
        if ( closeDatabaseConnectionResult == false OR closeDatabaseConnectionErrorInfo ~= nil ) then
                return false, closeDatabaseConnectionErrorInfo
        end
end

Replies to Re: Untitled rss

Title Name Language When
Re: Re: Untitled Mungo Kitten text 6 Years ago.