Facebook
From Mungo Kitten, 5 Years ago, written in Plain Text.
This paste is a reply to Re: Untitled from Insensitive Hog - go back
Embed
Viewing differences between Re: Untitled and Re: Re: Untitled
function 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
    
sens
        
local currentEntitiesCount, currentEntitiesCountErrorInfo = GetIntFromDatabase( "entitiesCount" )
    
)
        
if ( currentEntitiesCountErrorInfo ~= nil ) then
            
then
                
return false, currentEntitiesCountErrorInfo
    
currentEntitiesCountErrorInfo
        
end
    
        local createResult, createErrorMessage = ask_engine_to_do_something( "createEntity(" .. name .. ")" )
        if ( createResult == false OR createErrorMessage ~= nil ) then
                return false, createErrorMessage
        end
        
            -- sprawdzamy ponownie po utworzeniu krzesla liczbe entitek
    
entitek
        
local entitiesCountAfter, entitiesCountAfterErrorInfo = GetIntFromDatabase( "entitiesCount" )
    
)
        
if ( entitiesCountAfterErrorInfo ~= nil ) then
            
then
                
return false, entitiesCountAfterErrorInfo
    
entitiesCountAfterErrorInfo
        
end
    
            if ( currentEntitiesCount >= entitiesCountAfter ) then
            
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: Re: Untitled rss

Title Name Language When
Re: Re: Re: Untitled Perl Hedgehog text 5 Years ago.