Something I was recently introduced to is the PropEr testing system.
You should definitely look at that for testing your models, and
generating fake data.
You can get an instance of student by doing proper_gen:pick(student()).
student() ->
boss_record:new(student, [{name, name()}]).
arabic_name() ->
?LET(Name, list(weighted_union([{1, choose(16#0620, 16#064a)},
{1, choose(16#0671, 16#06d5)}])),
unicode:characters_to_binary(Name)).
cyrillic_name() ->
?LET(Name, list(weighted_union([{1, choose(16#0400, 16#04ff)}])),
unicode:characters_to_binary(Name)).
sinhala_name() ->
list(oneof([<<"අ">>,<<"ආ">>,<<"ඇ">>,<<"ඈ">>,<<"ඉ">>,<<"ඊ">>,<<"උ">>,<<"ඌ">>,<<"ඍ">>,<<"ඎ">>,<<"ඏ">>,<<"ඐ">>,<<"එ">>,<<"ඒ">>,<<"ඓ">>,<<"ඔ">>,<<"ඕ">>,<<"ඖ">>,<<"ක">>,<<"ඛ">>,<<"ග">>,<<"ඝ">>,<<"ඞ">>,<<"ඟ">>,<<"ච">>,<<"ඡ">>,<<"ජ">>,<<"ඣ">>,<<"ඤ">>,<<"ඥ">>,<<"ඦ">>,<<"ට">>,<<"ඨ">>,<<"ඩ">>,<<"ඪ">>,<<"ණ">>,<<"ඬ">>,<<"ත">>,<<"ථ">>,<<"ද">>,<<"ධ">>,<<"න">>,<<"ඳ">>,<<"ප">>,<<"ඵ">>,<<"බ">>,<<"භ">>,<<"ම">>,<<"ඹ">>,<<"ය">>,<<"ර">>,<<"ල">>,<<"ව">>,<<"ශ">>,<<"ෂ">>,<<"ස">>,<<"හ">>,<<"ළ">>,<<"ෆ">>,<<"්">>,<<"ා">>,<<"ැ">>,<<"ෑ">>,<<"ි">>,<<"ී">>,<<"ු">>,<<"ූ">>,<<"ෘ">>,<<"ෙ">>,<<"ේ">>,<<"ෛ">>,<<"ො">>,<<"ෝ">>,<<"ෞ">>,<<"ෟ">>])).
kanji_name() ->
?LET(Name, list(weighted_union([{1, choose(16#4e00, 16#9faf)}])),
unicode:characters_to_binary(Name)).
hangul_name() ->
?LET(Name, list(weighted_union([{1, choose(16#ac00, 16#d7af)}])),
unicode:characters_to_binary(Name)).
western_europe_name() ->
?LET(Name,
non_empty([choose($A, $Z) |
list(weighted_union([{20, choose($a, $z)},
{10, choose(16#c0, 16#ff)},
{1, $'},
{1, $-},
{1, $.},
{1, $ }]
))]),
unicode:characters_to_binary(Name)).
ascii_name() ->
non_empty([choose($A, $Z) |
list(weighted_union([{20, choose($a, $z)},
{1, $'},
{1, $-},
{1, $.},
{1, $ }]
))]).
name() ->
oneof([ascii_name(), western_europe_name(), hangul_name(),
kanji_name(), sinhala_name(), arabic_name(), cyrillic_name()]).
gender() ->
oneof(["male", "female", undefined]).
> --
> You received this message because you are subscribed to the Google Groups
> "ChicagoBoss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
chicagoboss...@googlegroups.com.
> Visit this group at
http://groups.google.com/group/chicagoboss.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/chicagoboss/498a776a-78c4-4061-aded-3afcc8b609a9%40googlegroups.com.
>
> For more options, visit
https://groups.google.com/groups/opt_out.
--
David N. Welton
http://www.welton.it/davidw/
http://www.dedasys.com/