You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
1.5 KiB
64 lines
1.5 KiB
import { describe, expect, it } from '@jest/globals';
|
|
import { toBoolean as $b, fromBoolean as _b } from '../src/bool';
|
|
import { fromNumber as _n } from '../src/num';
|
|
import { toChar as $, fromChar as _, eq } from '../src/char';
|
|
|
|
describe('Char', () => {
|
|
describe('toChar', () => {
|
|
it('converts "0"', () => {
|
|
expect($(_n(48))).toBe('0');
|
|
});
|
|
|
|
it('converts "a"', () => {
|
|
expect($(_n(97))).toBe('a');
|
|
});
|
|
|
|
it('converts "Z"', () => {
|
|
expect($(_n(90))).toBe('Z');
|
|
});
|
|
|
|
it('converts "-"', () => {
|
|
expect($(_n(45))).toBe('-');
|
|
});
|
|
});
|
|
|
|
describe('fromChar', () => {
|
|
it('converts "0"', () => {
|
|
expect($(_('0'))).toBe('0');
|
|
});
|
|
|
|
it('converts "a"', () => {
|
|
expect($(_('a'))).toBe('a');
|
|
});
|
|
|
|
it('converts "Z"', () => {
|
|
expect($(_('Z'))).toBe('Z');
|
|
});
|
|
|
|
it('converts "-"', () => {
|
|
expect($(_('-'))).toBe('-');
|
|
});
|
|
});
|
|
|
|
describe('eq', () => {
|
|
it('"0" eq "0" is True', () => {
|
|
expect(eq).toDeferEvaluationOf(_('0'), _('0'));
|
|
expect($b(eq._(_('0'))._(_('0')))).toBe(true);
|
|
});
|
|
|
|
it('"0" eq "a" is False', () => {
|
|
expect(eq).toDeferEvaluationOf(_('0'), _('a'));
|
|
expect($b(eq._(_('0'))._(_('a')))).toBe(false);
|
|
});
|
|
|
|
it('"a" eq "a" is True', () => {
|
|
expect(eq).toDeferEvaluationOf(_('a'), _('a'));
|
|
expect($b(eq._(_('a'))._(_('a')))).toBe(true);
|
|
});
|
|
|
|
it('"a" eq "z" is True', () => {
|
|
expect(eq).toDeferEvaluationOf(_('a'), _('z'));
|
|
expect($b(eq._(_('a'))._(_('z')))).toBe(false);
|
|
});
|
|
});
|
|
});
|
|
|