USE "Gwent - The Witcher Card Game"

GO

CREATE OR ALTER PROCEDURE populateFactions (@rows INT) AS
    WHILE @rows > 0
        BEGIN
            INSERT INTO Factions(name, totalMatches, totalWins, totalLosses, totalCards, totalDraws)
            VALUES ('test', -1, -1, -1, -1, -1)
            SET @rows = @rows - 1
        END
        
GO

CREATE OR ALTER VIEW getNameAndTotalMatches AS
    SELECT name, totalMatches
    FROM Factions

GO

EXEC addTests 'test1'
EXEC addToTables 'Factions'
EXEC addToViews 'getNameAndTotalMatches'
EXEC addTestTables 'test1', 'Factions', 1000, 1
EXEC addTestViews 'test1', 'getNameAndTotalMatches'

GO

EXEC runTest 'test1'
