cuelang.org/go@v0.13.0/pkg/uuid/testdata/uuid.txtar (about)

     1  -- in.cue --
     2  import "uuid"
     3  
     4  sha1: a: uuid.SHA1(uuid.ns.DNS, "cuelang.org")
     5  
     6  md5: a: uuid.MD5(uuid.ns.URL, "https://cuelang.org")
     7  
     8  validTable: {
     9  	a: "052ef62d-7223-58b6-a551-c1deee46d401"
    10  	b: "052EF62D-7223-58B6-A551-C1DEEE46D401"
    11  	c: "urn:uuid:123e4567-e89b-12d3-a456-426655440000"
    12  	d: "{123e4567-e89b-12d3-a456-426655440000}"
    13  	e: "123e4567e89b12d3a456426655440000"
    14  }
    15  
    16  invalidTable: {
    17  	a: "052ef62d_7223_58b6_a551_c1deee46d401"
    18  	b: "052ef62d-7223-58b6-a551-c1deee"
    19  	c: "{123e4567-e89b-12d3-a456-426655440000"
    20  }
    21  
    22  valid: {
    23  	for k, v in validTable {
    24  		ok: (k): v & uuid.Valid
    25  	}
    26  	for k, v in invalidTable {
    27  		err: (k): v & uuid.Valid
    28  	}
    29  }
    30  
    31  parse: {
    32  	for k, v in validTable {
    33  		ok: (k): uuid.Parse(v)
    34  	}
    35  	for k, v in invalidTable {
    36  		err: (k): uuid.Parse(v)
    37  	}
    38  }
    39  
    40  fromInt: a: uuid.FromInt(0x052ef62d_7223_58b6_a551_c1deee46d401)
    41  
    42  variant: a: uuid.Variant(sha1.a)
    43  version: a: uuid.Version(sha1.a)
    44  urn: a:     uuid.URN(sha1.a)
    45  toInt: a:   uuid.ToInt(sha1.a)
    46  -- out/uuid --
    47  Errors:
    48  valid.err.a: invalid value "052ef62d_7223_58b6_a551_c1deee46d401" (does not satisfy uuid.Valid): invalid UUID format:
    49      ./in.cue:16:5
    50      ./in.cue:26:13
    51  valid.err.b: invalid value "052ef62d-7223-58b6-a551-c1deee" (does not satisfy uuid.Valid): invalid UUID length: 30:
    52      ./in.cue:17:5
    53      ./in.cue:26:13
    54  valid.err.c: invalid value "{123e4567-e89b-12d3-a456-426655440000" (does not satisfy uuid.Valid): invalid UUID length: 37:
    55      ./in.cue:18:5
    56      ./in.cue:26:13
    57  parse.err.a: error in call to uuid.Parse: invalid UUID format:
    58      ./in.cue:35:13
    59  parse.err.b: error in call to uuid.Parse: invalid UUID length: 30:
    60      ./in.cue:35:13
    61  parse.err.c: error in call to uuid.Parse: invalid UUID length: 37:
    62      ./in.cue:35:13
    63  
    64  Result:
    65  sha1: {
    66  	a: "052ef62d-7223-58b6-a551-c1deee46d401"
    67  }
    68  md5: {
    69  	a: "d891d69e-ae5c-39e0-9ead-164abd207f1f"
    70  }
    71  validTable: {
    72  	a: "052ef62d-7223-58b6-a551-c1deee46d401"
    73  	b: "052EF62D-7223-58B6-A551-C1DEEE46D401"
    74  	c: "urn:uuid:123e4567-e89b-12d3-a456-426655440000"
    75  	d: "{123e4567-e89b-12d3-a456-426655440000}"
    76  	e: "123e4567e89b12d3a456426655440000"
    77  }
    78  invalidTable: {
    79  	a: "052ef62d_7223_58b6_a551_c1deee46d401"
    80  	b: "052ef62d-7223-58b6-a551-c1deee"
    81  	c: "{123e4567-e89b-12d3-a456-426655440000"
    82  }
    83  valid: {
    84  	ok: {
    85  		a: "052ef62d-7223-58b6-a551-c1deee46d401"
    86  		b: "052EF62D-7223-58B6-A551-C1DEEE46D401"
    87  		c: "urn:uuid:123e4567-e89b-12d3-a456-426655440000"
    88  		d: "{123e4567-e89b-12d3-a456-426655440000}"
    89  		e: "123e4567e89b12d3a456426655440000"
    90  	}
    91  	err: {
    92  		a: _|_ // valid.err.a: invalid value "052ef62d_7223_58b6_a551_c1deee46d401" (does not satisfy uuid.Valid): valid.err.a: invalid UUID format
    93  		b: _|_ // valid.err.b: invalid value "052ef62d-7223-58b6-a551-c1deee" (does not satisfy uuid.Valid): valid.err.b: invalid UUID length: 30
    94  		c: _|_ // valid.err.c: invalid value "{123e4567-e89b-12d3-a456-426655440000" (does not satisfy uuid.Valid): valid.err.c: invalid UUID length: 37
    95  	}
    96  }
    97  parse: {
    98  	ok: {
    99  		a: "052ef62d-7223-58b6-a551-c1deee46d401"
   100  		b: "052ef62d-7223-58b6-a551-c1deee46d401"
   101  		c: "123e4567-e89b-12d3-a456-426655440000"
   102  		d: "123e4567-e89b-12d3-a456-426655440000"
   103  		e: "123e4567-e89b-12d3-a456-426655440000"
   104  	}
   105  	err: {
   106  		a: _|_ // parse.err.a: error in call to uuid.Parse: invalid UUID format
   107  		b: _|_ // parse.err.b: error in call to uuid.Parse: invalid UUID length: 30
   108  		c: _|_ // parse.err.c: error in call to uuid.Parse: invalid UUID length: 37
   109  	}
   110  }
   111  fromInt: {
   112  	a: "052ef62d-7223-58b6-a551-c1deee46d401"
   113  }
   114  variant: {
   115  	a: 1
   116  }
   117  version: {
   118  	a: 5
   119  }
   120  urn: {
   121  	a: "urn:uuid:052ef62d-7223-58b6-a551-c1deee46d401"
   122  }
   123  toInt: {
   124  	a: 93651793875903522077150095950593860979557386807737776869062002310283964632724204171313
   125  }