TanklesXL / gladvent

A Gleam framework for running Advent of Code solutions
https://hex.pm/packages/gladvent
Apache License 2.0
27 stars 1 forks source link

RFC: consider stubbing in testing provisions #8

Closed cdaringe closed 9 months ago

cdaringe commented 9 months ago

Greetings! new gleam user. i know nil about gleam. would be awesome to also dump content for authoring some test code/test runner-y stuff!

Thanks for the consideration

TanklesXL commented 9 months ago

Hey! thanks for reaching out, though i'm not sure what you mean exactly. If you'd like to elaborate that would be grand!

FWIW when it comes to testing when using gladvent i tend to use regular gleam unit tests: https://github.com/TanklesXL/aoc/blob/main/test/aoc_2023/day_1_test.gleam

import aoc_2023/day_1
import gleeunit/should

pub fn pt_1_test() {
  "1abc2
pqr3stu8vwx
a1b2c3d4e5f
treb7uchet"
  |> day_1.pt_1
  |> should.equal(142)
}

pub fn pt_2_test() {
  "two1nine
eightwothree
abcone2threexyz
xtwone3four
4nineeightseven2
zoneight234
7pqrstsixteen"
  |> day_1.pt_2
  |> should.equal(281)
}