-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* add internet module template * update providers * update * add test cases * update * fix * Revert "fix" This reverts commit e2832a7. * Revert "Revert "fix"" This reverts commit 17f0f94. * update tool * update * update * add test cases
- Loading branch information
Showing
7 changed files
with
146 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# ----------------------------------------------- # | ||
# This module was generated by 'generator' tool . # | ||
# See 'tools/generator'. # | ||
# ----------------------------------------------- # | ||
|
||
import ../base | ||
import internet/[internet_en_US, internet_ja_JP] | ||
export base | ||
|
||
proc safeDomainName*(f: Faker): string = | ||
## Generates random safeDomainName. | ||
runnableExamples: | ||
let f = newFaker() | ||
echo f.safeDomainName() | ||
|
||
case f.locale | ||
of "en_US": internet_en_US.safeDomainName(f) | ||
of "ja_JP": internet_ja_JP.safeDomainName(f) | ||
else: internet_en_US.safeDomainName(f) | ||
|
||
proc freeDomainName*(f: Faker): string = | ||
## Generates random freeDomainName. | ||
runnableExamples: | ||
let f = newFaker() | ||
echo f.freeDomainName() | ||
|
||
case f.locale | ||
of "en_US": internet_en_US.freeDomainName(f) | ||
of "ja_JP": internet_ja_JP.freeDomainName(f) | ||
else: internet_en_US.freeDomainName(f) | ||
|
||
proc topLevelDomain*(f: Faker): string = | ||
## Generates random topLevelDomain. | ||
runnableExamples: | ||
let f = newFaker() | ||
echo f.topLevelDomain() | ||
|
||
case f.locale | ||
of "en_US": internet_en_US.topLevelDomain(f) | ||
of "ja_JP": internet_ja_JP.topLevelDomain(f) | ||
else: internet_en_US.topLevelDomain(f) | ||
|
||
proc safeEmail*(f: Faker): string = | ||
## Generates random safeEmail. | ||
runnableExamples: | ||
let f = newFaker() | ||
echo f.safeEmail() | ||
|
||
case f.locale | ||
of "en_US": internet_en_US.safeEmail(f) | ||
of "ja_JP": internet_ja_JP.safeEmail(f) | ||
else: internet_en_US.safeEmail(f) | ||
|
||
proc freeEmail*(f: Faker): string = | ||
## Generates random freeEmail. | ||
runnableExamples: | ||
let f = newFaker() | ||
echo f.freeEmail() | ||
|
||
case f.locale | ||
of "en_US": internet_en_US.freeEmail(f) | ||
of "ja_JP": internet_ja_JP.freeEmail(f) | ||
else: internet_en_US.freeEmail(f) | ||
|
||
proc email*(f: Faker): string = | ||
## Generates random email. | ||
runnableExamples: | ||
let f = newFaker() | ||
echo f.email() | ||
|
||
case f.locale | ||
of "en_US": internet_en_US.email(f) | ||
of "ja_JP": internet_ja_JP.email(f) | ||
else: internet_en_US.email(f) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# interfaces はプロシージャの定義のみをまとめたモジュール。 | ||
# C言語でいうヘッダファイルのように使用する。 | ||
# | ||
# このモジュールをincludeしたモジュールは、このモジュールに定義しているプロシー | ||
# ジャを全て実装しないと、コンパイルが通らない。 | ||
|
||
import random | ||
import ../../base | ||
export base | ||
|
||
const | ||
safeDomainNames = @["example.org", "example.com", "example.net"] | ||
freeDomainNames = @["gmail.com", "yahoo.co.jp", "hotmail.com"] | ||
topLevelDomains = @["com", "biz", "info", "net", "org"] | ||
|
||
proc safeDomainName*(f: Faker): string = | ||
f.rand.sample(safeDomainNames) | ||
|
||
proc freeDomainName*(f: Faker): string = | ||
f.rand.sample(freeDomainNames) | ||
|
||
proc topLevelDomain*(f: Faker): string = | ||
f.rand.sample(topLevelDomains) | ||
|
||
proc safeEmail*(f: Faker): string | ||
proc freeEmail*(f: Faker): string | ||
proc email*(f: Faker): string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
include interfaces | ||
import strutils | ||
import ../person | ||
|
||
proc safeEmail*(f: Faker): string = | ||
f.firstName.toLower & "@" & f.safeDomainName | ||
|
||
proc freeEmail*(f: Faker): string = | ||
f.firstName.toLower & "@" & f.freeDomainName | ||
|
||
proc email*(f: Faker): string = | ||
let domain = | ||
if rand(1) == 0: | ||
f.freeDomainName | ||
else: | ||
f.safeDomainName | ||
f.firstName.toLower & "@" & domain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
include interfaces | ||
import strutils | ||
import ../person/person_ja_JP | ||
|
||
proc safeEmail*(f: Faker): string = | ||
f.firstRomanizedName.toLower & "@" & f.safeDomainName | ||
|
||
proc freeEmail*(f: Faker): string = | ||
f.firstRomanizedName.toLower & "@" & f.freeDomainName | ||
|
||
proc email*(f: Faker): string = | ||
let domain = | ||
if rand(1) == 0: | ||
f.freeDomainName | ||
else: | ||
f.safeDomainName | ||
f.firstRomanizedName.toLower & "@" & domain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters