Files
dragoncode-decoder/tests/test-data.js
2026-01-30 12:08:22 +02:00

333 lines
13 KiB
JavaScript

// Comprehensive test data extracted from Dragon Code V2.6 specification
// Each test case includes: tag, expected parsing, and expected decoded output
const TEST_CASES = {
species: [
{
code: 'DC2.Dw',
tag: 'Dw',
expected: {
parse: { type: 'simple', value: 'Dw' },
decode: 'Western Dragon'
}
},
{
code: 'DC2.De',
tag: 'De',
expected: {
parse: { type: 'simple', value: 'De' },
decode: 'Eastern Dragon'
}
},
{
code: 'DC2.H',
tag: 'H',
expected: {
parse: { type: 'simple', value: 'H' },
decode: 'Human'
}
},
{
code: 'DC2.~Dw/H',
tag: '~Dw/H',
expected: {
parse: { type: 'shapechanger' },
decode: 'I change between Western Dragon and Human form'
}
},
{
code: 'DC2.Dw+H',
tag: 'Dw+H',
expected: {
parse: { type: 'cross' },
decode: 'A cross between Western Dragon and Human'
}
},
{
code: 'DC2.D[H]',
tag: 'D[H]',
expected: {
parse: { type: 'trapped' },
decode: 'trapped in Human form'
}
}
],
gender: [
{ code: 'Gm', expected: 'Male' },
{ code: 'Gf', expected: 'Female' },
{ code: 'Gh', expected: 'Hermaphrodite' },
{ code: 'Gn', expected: 'Neuter' },
{ code: 'G?', expected: 'not telling' },
{ code: 'G~', expected: 'variable' }
],
length: [
{ code: 'L+++!', expected: 'Celestial' },
{ code: 'L+++', expected: 'Mistaken for mountain ranges' },
{ code: 'L++', expected: 'Lair fits a regiment' },
{ code: 'L+', expected: 'Bigger than most dragons' },
{ code: 'L', expected: 'Normal (Draco-sized)' },
{ code: 'L-', expected: 'Smaller than most dragons' },
{ code: 'L--', expected: 'Fits on your shoulder' },
{ code: 'L---', expected: 'Fits in your pocket' },
{ code: 'L---!', expected: 'Microscopic' },
{ code: 'L10m', expected: '10 meters' },
{ code: 'L10f', expected: '10 feet' },
{ code: 'L10m4t', expected: '10 meters (with 4meters tail length)' }
],
width: [
{ code: 'W+++!', expected: "I am Athelind! My belly is now several galaxies wide" },
{ code: 'W+++', expected: "Planets have been known to crack in half with my arrival!" },
{ code: 'W++', expected: "My digestion of food has been known to cause earthquakes" },
{ code: 'W+', expected: "I move by rolling" },
{ code: 'W', expected: "I'm normal" },
{ code: 'W~', expected: "Variable" },
{ code: 'W-', expected: "slightly on the slim side" },
{ code: 'W--', expected: "serpentine" },
{ code: 'W---', expected: "long string with wings" },
{ code: 'W---!', expected: "one-dimensional" }
],
weight: [
{ code: 'T+++', expected: 'Obese' },
{ code: 'T++', expected: 'Fat' },
{ code: 'T+', expected: 'Over-weight' },
{ code: 'T', expected: 'Normal weight' },
{ code: 'T-', expected: 'Under-weight' },
{ code: 'T--', expected: 'Skeleton with scales' },
{ code: 'T---', expected: 'Anorexic' }
],
skinType: [
{ code: 'Sks', expected: 'scales' },
{ code: 'Skh', expected: 'hide' },
{ code: 'Sku', expected: 'fur' },
{ code: 'Skk', expected: 'skin' },
{ code: 'Skl', expected: 'leather' },
{ code: 'Skm', expected: 'metal' },
{ code: 'Skr', expected: 'rock' },
{ code: 'Skf', expected: 'feathers' },
{ code: 'Ske', expected: 'exoskeleton' },
{ code: 'Skb', expected: 'bark' },
{ code: 'Skc', expected: 'cellulose' },
{ code: 'Skx', expected: 'crystals' },
{ code: 'Sk?', expected: 'Unknown' },
{ code: 'Sks,ak', expected: 'scales, with skin on arms' },
{ code: 'Sks,bm', expected: 'scales, with metal on belly' }
],
age: [
{ code: 'A+++!', expected: 'Eternal' },
{ code: 'A+++', expected: 'Ancient beyond measure' },
{ code: 'A++', expected: 'Ancient' },
{ code: 'A+', expected: "You've been around" },
{ code: 'A', expected: 'Adult' },
{ code: 'A-', expected: 'Young adult' },
{ code: 'A--', expected: 'Adolescent' },
{ code: 'A---', expected: 'Hatchling' },
{ code: 'A?', expected: 'Unknown age' }
],
breath: [
{ code: 'B+++', expected: 'Legendary breath weapon' },
{ code: 'B++', expected: 'Very powerful breath' },
{ code: 'B+', expected: 'Above average breath' },
{ code: 'B', expected: 'Normal breath weapon' },
{ code: 'B-', expected: 'Weak breath' },
{ code: 'B--', expected: 'Very weak breath' },
{ code: 'B---', expected: 'No breath weapon' },
{ code: 'Bfl', expected: 'flame' },
{ code: 'Bfi', expected: 'fire' },
{ code: 'Bac', expected: 'acid' },
{ code: 'Bic', expected: 'ice' },
{ code: 'Bli', expected: 'lightning' }
],
reality: [
{ code: 'R+++', expected: 'I AM a dragon' },
{ code: 'R++', expected: 'Strongly identify with on-line form' },
{ code: 'R+', expected: 'Identify with character' },
{ code: 'R', expected: 'Just playing' },
{ code: 'R-', expected: "It's only a game" },
{ code: 'R--', expected: "Don't confuse RL with online" },
{ code: 'R---', expected: 'Completely separate' }
],
activity: [
{ code: 'Ac+++!', expected: 'T1 connection, never off the net' },
{ code: 'Ac+++', expected: 'Online most of the time' },
{ code: 'Ac++', expected: 'Online frequently' },
{ code: 'Ac+', expected: 'Online regularly' },
{ code: 'Ac', expected: 'Moderate activity' },
{ code: 'Ac-', expected: 'Occasional visits' },
{ code: 'Ac--', expected: 'Rare appearances' },
{ code: 'Ac---', expected: 'Almost never online' }
],
technology: [
{ code: 'Tc+++', expected: 'Program in assembly' },
{ code: 'Tc++', expected: 'Expert programmer' },
{ code: 'Tc+', expected: 'Competent with tech' },
{ code: 'Tc', expected: 'Normal tech skills' },
{ code: 'Tc-', expected: 'Basic computer use' },
{ code: 'Tc--', expected: 'Technology challenged' },
{ code: 'Tc---', expected: "What's a computer?" },
{ code: 'Tc+++[SE]', expected: 'Program in assembly, specialist in SE' }
],
mating: [
{ code: 'M+++!1', expected: 'Mated in RL to online mate\'s RL self, 1 mate' },
{ code: 'M+++', expected: 'Mated to RL person I met online' },
{ code: 'M++', expected: 'Mated online, not met in RL' },
{ code: 'M+', expected: 'Mated/married' },
{ code: 'M', expected: 'Dating' },
{ code: 'M-', expected: 'Looking' },
{ code: 'M--', expected: 'Not interested' },
{ code: 'M---', expected: 'Sworn celibate' }
],
offspring: [
{ code: 'O+++', expected: 'Large family' },
{ code: 'O++', expected: 'Several offspring' },
{ code: 'O+', expected: 'Have offspring' },
{ code: 'O', expected: 'Interested in having' },
{ code: 'O-', expected: 'Not interested' },
{ code: 'O--', expected: "Don't even think about it" },
{ code: 'O---', expected: 'Absolutely not' },
{ code: 'O/', expected: "If one was my fault, I'd faint" }
],
hoard: [
{ code: 'DC2.Dw H+++', expected: "Really can't tell when someone steals" },
{ code: 'DC2.Dw H++', expected: 'Large hoard' },
{ code: 'DC2.Dw H+', expected: 'Growing collection' },
{ code: 'DC2.Dw H', expected: 'Small hoard' },
{ code: 'DC2.Dw H-', expected: 'Starting out' },
{ code: 'DC2.Dw H--', expected: 'No hoard yet' },
{ code: 'DC2.Dw H---', expected: 'No interest in hoarding' }
],
money: [
{ code: '$$$', expected: 'Richest dragon alive' },
{ code: '$$', expected: 'Wealthy' },
{ code: '$', expected: "Don't touch my hoard" },
{ code: '$-', expected: 'Getting by' },
{ code: '$--', expected: 'Poor' },
{ code: '$---', expected: 'Broke' }
],
diet: [
{ code: 'F+++o', expected: 'Glutton omnivore' },
{ code: 'F++o', expected: 'Overindulgent omnivore' },
{ code: 'F+o', expected: 'Healthy appetite omnivore' },
{ code: 'Fc', expected: 'carnivore' },
{ code: 'Fh', expected: 'herbivore' },
{ code: 'Fo', expected: 'omnivore' },
{ code: 'Fv', expected: 'vegetarian' }
],
humor: [
{ code: 'J+++', expected: 'Constantly joking' },
{ code: 'J++', expected: 'Laughing is good for you' },
{ code: 'J+', expected: 'Good sense of humor' },
{ code: 'J', expected: 'Normal humor' },
{ code: 'J-', expected: 'Serious' },
{ code: 'J--', expected: 'Very serious' },
{ code: 'J---', expected: 'No sense of humor' }
],
social: [
{ code: 'S+++', expected: 'Everyone knows' },
{ code: 'S++', expected: 'Most people know' },
{ code: 'S+', expected: 'Several people know' },
{ code: 'S', expected: 'A few friends know' },
{ code: 'S-', expected: 'Very select few know' },
{ code: 'S--', expected: 'One or two people know' },
{ code: 'S---', expected: 'Complete secret' },
{ code: 'S!', expected: 'Out and proud' }
],
ubiquity: [
{ code: 'U+++', expected: 'Legendary status' },
{ code: 'U++', expected: 'Well known' },
{ code: 'U+', expected: 'Known in community' },
{ code: 'U', expected: 'Regular member' },
{ code: 'U-', expected: 'Pretty sure did something important' },
{ code: 'U--', expected: 'Mostly unnoticed' },
{ code: 'U---', expected: 'Unknown' }
],
irritability: [
{ code: 'I+++', expected: 'Constantly angry' },
{ code: 'I++', expected: 'Short temper' },
{ code: 'I+', expected: 'Get annoyed easily' },
{ code: 'I', expected: 'Normal temperament' },
{ code: 'I-', expected: 'Patient' },
{ code: 'I--', expected: 'Take everything in stride' },
{ code: 'I---', expected: 'Nothing bothers me' }
],
magic: [
{ code: 'V+++', expected: 'Archmage level' },
{ code: 'V++', expected: 'Powerful magic' },
{ code: 'V+', expected: 'Competent magic user' },
{ code: 'V', expected: 'Some magical ability' },
{ code: 'V-', expected: 'Minor magic' },
{ code: 'V--', expected: 'Magicians worry when near' },
{ code: 'V---', expected: 'Magic has no effect' }
],
psyPower: [
{ code: 'Q+++', expected: 'Master psychic' },
{ code: 'Q++', expected: 'Strong psychic' },
{ code: 'Q+', expected: 'Psychic abilities' },
{ code: 'Q', expected: 'Minor psychic talent' },
{ code: 'Q-', expected: 'Resistant to psionics' },
{ code: 'Q--', expected: 'Immune to psionics' },
{ code: 'Q---', expected: 'Psionics have no effect' }
],
emotion: [
{ code: 'E+++', expected: 'Extremely affectionate' },
{ code: 'E++', expected: 'Fairly free with hugs' },
{ code: 'E+', expected: 'Affectionate' },
{ code: 'E', expected: 'Normal emotional expression' },
{ code: 'E-', expected: 'Reserved' },
{ code: 'E--', expected: 'Emotionally distant' },
{ code: 'E---', expected: 'Cold/unemotional' }
],
dragonFriend: [
{ code: 'Df+++!', expected: "Have you noticed? You've started growing scales!" },
{ code: 'Df+++', expected: 'Popular with dragons - you exchange overnight visits' },
{ code: 'Df++', expected: 'Reasonably popular - you exchange social visits' },
{ code: 'Df+', expected: 'Polite acquaintance - you exchange social pleasantries' },
{ code: 'Df', expected: "Tolerance - they don't eat you" },
{ code: 'Df-', expected: 'Irritant - they think about having you over for lunch!' },
{ code: 'Df--', expected: 'Maddening - they think about a quick snack ... now!' },
{ code: 'Df---', expected: "Infuriating - you're not good enough for a snack" },
{ code: 'Df---!', expected: "Cold fury - they're going to hunt you, and find you, and..." }
]
};
// Full integration test cases
const INTEGRATION_TESTS = [
{
name: 'Full Example from Spec',
code: 'DC2.Dw Gm L W T+ Phvwalt Sk? Cbk--^\\bl+lum B- A+ N? M+++!1 O/ H+++ $ F+o R++ Ac+++! J++ S U- I-- V- Q--- Tc+++[SE] E++',
expectedTags: {
species: 'Western Dragon',
gender: 'Male',
length: 'Normal (Draco-sized)',
width: "I'm normal",
weight: 'Over-weight',
skinType: 'Unknown',
breath: 'Weak breath',
age: "You've been around",
technology: 'Program in assembly, specialist in SE'
}
}
];