pub struct Vector {
pub platform: &'static str,
pub input: &'static str,
pub output: &'static str,
pub accepted: bool,
pub error_kind: u8,
}
pub const PLATFORM_X_DOMAIN: &str = "dyaka.identity.platform.x";
pub const PLATFORM_GITHUB_DOMAIN: &str = "dyaka.identity.platform.github";
pub const PLATFORM_GOOGLE_DOMAIN: &str = "dyaka.identity.platform.google";
pub const MAX_LENGTH_X: usize = 15;
pub const MAX_LENGTH_GITHUB: usize = 39;
pub const MAX_LENGTH_GOOGLE: usize = 62;
pub const STRIP_LEADING_AT_X: bool = true;
pub const IS_EMAIL_X: bool = false;
pub const ALLOW_UNDERSCORE_X: bool = true;
pub const ALLOW_HYPHEN_X: bool = false;
pub const STRIP_LEADING_AT_GITHUB: bool = true;
pub const IS_EMAIL_GITHUB: bool = false;
pub const ALLOW_UNDERSCORE_GITHUB: bool = false;
pub const ALLOW_HYPHEN_GITHUB: bool = true;
pub const STRIP_LEADING_AT_GOOGLE: bool = false;
pub const IS_EMAIL_GOOGLE: bool = true;
pub const ALLOW_UNDERSCORE_GOOGLE: bool = false;
pub const ALLOW_HYPHEN_GOOGLE: bool = false;
pub const FUTURE_ALLOWANCE_X: u64 = 300;
pub const FUTURE_ALLOWANCE_GITHUB: u64 = 300;
pub const FUTURE_ALLOWANCE_GOOGLE: u64 = 7200;
pub const ERROR_EMPTY: u8 = 0;
pub const ERROR_TOOLONG: u8 = 1;
pub const ERROR_BADCHARACTER: u8 = 2;
pub const ERROR_BADSHAPE: u8 = 3;
pub const VECTORS: [Vector; 44] = [
Vector {
platform: "x",
input: " @Alice_1 ",
output: "alice_1",
accepted: true,
error_kind: 0,
},
Vector {
platform: "x",
input: "alice",
output: "alice",
accepted: true,
error_kind: 0,
},
Vector {
platform: "x",
input: "@a",
output: "a",
accepted: true,
error_kind: 0,
},
Vector {
platform: "x",
input: "A1_b2",
output: "a1_b2",
accepted: true,
error_kind: 0,
},
Vector {
platform: "x",
input: "a12345678901234",
output: "a12345678901234",
accepted: true,
error_kind: 0,
},
Vector {
platform: "x",
input: "a123456789012345",
output: "",
accepted: false,
error_kind: 1,
},
Vector {
platform: "x",
input: "",
output: "",
accepted: false,
error_kind: 0,
},
Vector {
platform: "x",
input: " ",
output: "",
accepted: false,
error_kind: 0,
},
Vector {
platform: "x",
input: "@",
output: "",
accepted: false,
error_kind: 0,
},
Vector {
platform: "x",
input: "@@alice",
output: "",
accepted: false,
error_kind: 2,
},
Vector {
platform: "x",
input: "alice-1",
output: "",
accepted: false,
error_kind: 2,
},
Vector {
platform: "x",
input: "ali ce",
output: "",
accepted: false,
error_kind: 2,
},
Vector {
platform: "x",
input: "ali\tce",
output: "",
accepted: false,
error_kind: 2,
},
Vector {
platform: "x",
input: "ali\nce",
output: "",
accepted: false,
error_kind: 2,
},
Vector {
platform: "x",
input: "alic\u{e9}",
output: "",
accepted: false,
error_kind: 2,
},
Vector {
platform: "x",
input: "\talice",
output: "",
accepted: false,
error_kind: 2,
},
Vector {
platform: "x",
input: "alice\t",
output: "",
accepted: false,
error_kind: 2,
},
Vector {
platform: "x",
input: "\nalice",
output: "",
accepted: false,
error_kind: 2,
},
Vector {
platform: "x",
input: " @ alice ",
output: "",
accepted: false,
error_kind: 2,
},
Vector {
platform: "github",
input: "@Octo-Cat",
output: "octo-cat",
accepted: true,
error_kind: 0,
},
Vector {
platform: "github",
input: "octocat",
output: "octocat",
accepted: true,
error_kind: 0,
},
Vector {
platform: "github",
input: " OctoCat ",
output: "octocat",
accepted: true,
error_kind: 0,
},
Vector {
platform: "github",
input: "a",
output: "a",
accepted: true,
error_kind: 0,
},
Vector {
platform: "github",
input: "o-c",
output: "o-c",
accepted: true,
error_kind: 0,
},
Vector {
platform: "github",
input: "-octocat",
output: "",
accepted: false,
error_kind: 3,
},
Vector {
platform: "github",
input: "octocat-",
output: "",
accepted: false,
error_kind: 3,
},
Vector {
platform: "github",
input: "octo--cat",
output: "",
accepted: false,
error_kind: 3,
},
Vector {
platform: "github",
input: "octo_cat",
output: "",
accepted: false,
error_kind: 2,
},
Vector {
platform: "github",
input: "-",
output: "",
accepted: false,
error_kind: 3,
},
Vector {
platform: "github",
input: "",
output: "",
accepted: false,
error_kind: 0,
},
Vector {
platform: "github",
input: "abcdefghijabcdefghijabcdefghijabcdefghi",
output: "abcdefghijabcdefghijabcdefghijabcdefghi",
accepted: true,
error_kind: 0,
},
Vector {
platform: "github",
input: "abcdefghijabcdefghijabcdefghijabcdefghij",
output: "",
accepted: false,
error_kind: 1,
},
Vector {
platform: "github",
input: "\n",
output: "",
accepted: false,
error_kind: 2,
},
Vector {
platform: "google",
input: "A.B+tag@Example.COM",
output: "a.b+tag@example.com",
accepted: true,
error_kind: 0,
},
Vector {
platform: "google",
input: "alice@example.com",
output: "alice@example.com",
accepted: true,
error_kind: 0,
},
Vector {
platform: "google",
input: " Alice@Example.com ",
output: "alice@example.com",
accepted: true,
error_kind: 0,
},
Vector {
platform: "google",
input: "@Alice@example.com",
output: "",
accepted: false,
error_kind: 3,
},
Vector {
platform: "google",
input: "alice",
output: "",
accepted: false,
error_kind: 3,
},
Vector {
platform: "google",
input: "@example.com",
output: "",
accepted: false,
error_kind: 3,
},
Vector {
platform: "google",
input: "alice@",
output: "",
accepted: false,
error_kind: 3,
},
Vector {
platform: "google",
input: "",
output: "",
accepted: false,
error_kind: 0,
},
Vector {
platform: "google",
input: "ali ce@example.com",
output: "",
accepted: false,
error_kind: 2,
},
Vector {
platform: "google",
input: "abcdefghijabcdefghijabcdefghijabcdefghijabcdefghij@example.com",
output: "abcdefghijabcdefghijabcdefghijabcdefghijabcdefghij@example.com",
accepted: true,
error_kind: 0,
},
Vector {
platform: "google",
input: "abcdefghijabcdefghijabcdefghijabcdefghijabcdefghijk@example.com",
output: "",
accepted: false,
error_kind: 1,
},
];