go.charczuk.com@v0.0.0-20240327042549-bc490516bd1a/projects/kana-server/pkg/types/quiz_stats_test.go (about)

     1  /*
     2  
     3  Copyright (c) 2023 - Present. Will Charczuk. All rights reserved.
     4  Use of this source code is governed by a MIT license that can be found in the LICENSE file at the root of the repository.
     5  
     6  */
     7  
     8  package types_test
     9  
    10  import (
    11  	"testing"
    12  
    13  	. "go.charczuk.com/sdk/assert"
    14  
    15  	"go.charczuk.com/projects/kana-server/pkg/types"
    16  )
    17  
    18  func Test_QuizStats_PercentCorrect(t *testing.T) {
    19  	ItsEqual(t, 0.0, types.QuizStats{}.PercentCorrect())
    20  	ItsEqual(t, 25.0, types.QuizStats{Total: 4, Correct: 1}.PercentCorrect())
    21  }