program main
  fn parse_u32(text: string) -> (result u32 i32)
    call std.string.parse_u32_result
      var text
  fn parsed_text(text: string) -> string
    call std.num.u32_to_string
      std.result.unwrap_ok
        call parse_u32
          var text
  fn main() -> i32
    local let value: (result u32 i32)
      call parse_u32
        string "42"
    if
      std.result.is_ok
        var value
      if
        binary =
          call std.num.u32_to_string
            std.result.unwrap_ok
              var value
          string "42"
        int 0
        int 1
      std.result.unwrap_err
        var value
  test "parse u32 zero ok"
    binary =
      call parsed_text
        string "0"
      string "0"
  test "parse u32 high ok"
    binary =
      call parsed_text
        string "4294967295"
      string "4294967295"
  test "parse u32 empty err"
    local let value: (result u32 i32)
      call parse_u32
        string ""
    if
      std.result.is_err
        var value
      binary =
        std.result.unwrap_err
          var value
        int 1
      bool false
  test "parse u32 plus err"
    local let value: (result u32 i32)
      call parse_u32
        string "+1"
    if
      std.result.is_err
        var value
      binary =
        std.result.unwrap_err
          var value
        int 1
      bool false
  test "parse u32 negative err"
    local let value: (result u32 i32)
      call parse_u32
        string "-1"
    if
      std.result.is_err
        var value
      binary =
        std.result.unwrap_err
          var value
        int 1
      bool false
  test "parse u32 above range err"
    local let value: (result u32 i32)
      call parse_u32
        string "4294967296"
    if
      std.result.is_err
        var value
      binary =
        std.result.unwrap_err
          var value
        int 1
      bool false
