Skip to content

Commit

Permalink
correct tests
Browse files Browse the repository at this point in the history
  • Loading branch information
FranciscoLira committed Aug 24, 2023
1 parent eabb008 commit a97c300
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 48 deletions.
2 changes: 1 addition & 1 deletion lib/faker.ex
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ defmodule Faker do
acc
end

@alphabet 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
@alphabet ~c"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
defp letter do
Enum.at(@alphabet, random_between(0, Enum.count(@alphabet) - 1))
end
Expand Down
2 changes: 1 addition & 1 deletion lib/faker/address.ex
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ defmodule Faker.Address do

alias Faker.Person

@geobase32 '0123456789bcdefghjkmnpqrstuvwxyz'
@geobase32 ~c"0123456789bcdefghjkmnpqrstuvwxyz"

@moduledoc """
Functions for generating addresses.
Expand Down
32 changes: 16 additions & 16 deletions lib/faker/address/pt_br.ex
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ defmodule Faker.Address.PtBr do
## Examples
iex> Faker.Address.PtBr.city()
"Senador Kaique Paulista"
"Senador Suélen das Pedras"
iex> Faker.Address.PtBr.city()
"São Roberta dos Dourados"
"São Pedro Lucas do Sul"
iex> Faker.Address.PtBr.city()
"Salto das Flores"
"Três Pedro Henrique"
iex> Faker.Address.PtBr.city()
"Kléber"
"João Gabriel Alegre"
"""
@spec city() :: String.t()
def city do
Expand Down Expand Up @@ -1034,13 +1034,13 @@ defmodule Faker.Address.PtBr do
## Examples
iex> Faker.Address.PtBr.street_address()
"Estação Kaique, 2"
"Estação Suélen, 646"
iex> Faker.Address.PtBr.street_address()
"Lagoa Matheus, 0832"
"Recanto Arthur, 970"
iex> Faker.Address.PtBr.street_address()
"Estrada Diegues, s/n"
"Trecho Júlia Viana, s/n"
iex> Faker.Address.PtBr.street_address()
"Praia Limeira, 020"
"Passarela Morais, s/n"
"""
@spec street_address() :: String.t()
def street_address do
Expand All @@ -1053,13 +1053,13 @@ defmodule Faker.Address.PtBr do
## Examples
iex> Faker.Address.PtBr.street_address(true)
"Estação Kaique, 2 Sala 461"
"Estação Suélen, 646 AP 083"
iex> Faker.Address.PtBr.street_address(false)
"Conjunto Rodrigo, 970"
"Setor da Penha, s/n"
iex> Faker.Address.PtBr.street_address(false)
"Trecho Davi Luiz Limeira, 020"
"Trecho Júlia Viana, s/n"
iex> Faker.Address.PtBr.street_address(false)
"Sítio Maria Eduarda, 097"
"Passarela Morais, s/n"
"""
@spec street_address(true | any) :: String.t()
def street_address(true), do: street_address() <> " " <> secondary_address()
Expand All @@ -1071,13 +1071,13 @@ defmodule Faker.Address.PtBr do
## Examples
iex> Faker.Address.PtBr.street_name()
"Estação Kaique"
"Estação Suélen"
iex> Faker.Address.PtBr.street_name()
"Morro Louise Macieira"
"Colônia Macieira"
iex> Faker.Address.PtBr.street_name()
"Loteamento Maria Alice Junqueira"
"Loteamento Emanuel Albuquerque"
iex> Faker.Address.PtBr.street_name()
"Condomínio da Maia"
"Setor da Penha"
"""
@spec street_name() :: String.t()
def street_name do
Expand Down
20 changes: 10 additions & 10 deletions lib/faker/file.ex
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ defmodule Faker.File do
## Examples
iex> Faker.File.file_extension()
"wav"
"txt"
iex> Faker.File.file_extension()
"wav"
"html"
iex> Faker.File.file_extension()
"doc"
"flac"
iex> Faker.File.file_extension()
"mov"
"odt"
"""
@spec file_extension() :: String.t()
def file_extension do
Expand Down Expand Up @@ -84,11 +84,11 @@ defmodule Faker.File do
iex> Faker.File.file_name()
"aliquam.jpg"
iex> Faker.File.file_name()
"deleniti.doc"
"deleniti.flac"
iex> Faker.File.file_name()
"qui.jpg"
iex> Faker.File.file_name()
"quibusdam.csv"
"quibusdam.webm"
"""
@spec file_name() :: String.t()
def file_name do
Expand Down Expand Up @@ -121,13 +121,13 @@ defmodule Faker.File do
## Examples
iex> Faker.File.mime_type()
"text/css"
"model/mesh"
iex> Faker.File.mime_type()
"message/http"
"image/tiff"
iex> Faker.File.mime_type()
"application/ogg"
"message/partial"
iex> Faker.File.mime_type()
"model/x3d+xml"
"audio/webm"
"""
@spec mime_type :: String.t()
def mime_type do
Expand Down
2 changes: 1 addition & 1 deletion lib/faker/lorem.ex
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ defmodule Faker.Lorem do
end

defp character do
alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
alphabet = ~c"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
Enum.at(alphabet, Faker.random_between(0, Enum.count(alphabet) - 1))
end
end
32 changes: 16 additions & 16 deletions lib/faker/person/pt_br.ex
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ defmodule Faker.Person.PtBr do
## Examples
iex> Faker.Person.PtBr.name()
"Sra. Kaique Mendes Neto"
"Dr. Hélio Mendes Neto"
iex> Faker.Person.PtBr.name()
"Roberta Garcês"
"Bernardo Mangueira"
iex> Faker.Person.PtBr.name()
"Sr. Vitor Albuquerque"
"Sr. Arthur Santana Neto"
iex> Faker.Person.PtBr.name()
"Maria Laura da Penha Jr."
"João Gabriel Resende"
"""
@spec name() :: String.t()
def name, do: name(Faker.random_between(0, 9))
Expand All @@ -38,13 +38,13 @@ defmodule Faker.Person.PtBr do
## Examples
iex> Faker.Person.PtBr.first_name()
"Augusto"
"Luiz Henrique"
iex> Faker.Person.PtBr.first_name()
"Amanda"
"Suélen"
iex> Faker.Person.PtBr.first_name()
"Kaique"
"Arthur Henrique"
iex> Faker.Person.PtBr.first_name()
"Antonia"
"Bernardo"
"""
@spec first_name() :: String.t()
def first_name, do: first_name(Faker.random_between(0, 1))
Expand All @@ -57,13 +57,13 @@ defmodule Faker.Person.PtBr do
## Examples
iex> Faker.Person.PtBr.male_first_name()
"Augusto"
"Bruno"
iex> Faker.Person.PtBr.male_first_name()
"Benjamin"
"Luiz Henrique"
iex> Faker.Person.PtBr.male_first_name()
"Kaique"
"Hélio"
iex> Faker.Person.PtBr.male_first_name()
"Frederico"
"Mathias"
"""
@spec male_first_name() :: String.t()
sampler(:male_first_name, [
Expand Down Expand Up @@ -215,13 +215,13 @@ defmodule Faker.Person.PtBr do
## Examples
iex> Faker.Person.PtBr.female_first_name()
"Luna"
"Maria Helena"
iex> Faker.Person.PtBr.female_first_name()
"Amanda"
"Alessandra"
iex> Faker.Person.PtBr.female_first_name()
"Maria Isis"
"Ayla"
iex> Faker.Person.PtBr.female_first_name()
"Antonia"
"Suélen"
"""

@spec female_first_name() :: String.t()
Expand Down
6 changes: 3 additions & 3 deletions lib/faker/util.ex
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ defmodule Faker.Util do
iex> Faker.Util.sample_uniq(0, &Faker.Internet.email/0)
** (FunctionClauseError) no function clause matching in Faker.Util.sample_uniq/3
"""
@spec sample_uniq(pos_integer, (() -> any), MapSet.t()) :: [any]
@spec sample_uniq(pos_integer, (-> any), MapSet.t()) :: [any]
def sample_uniq(count, sampler, acc \\ MapSet.new())
when is_integer(count) and count > 0 and is_function(sampler, 0) do
case MapSet.size(acc) do
Expand Down Expand Up @@ -84,7 +84,7 @@ defmodule Faker.Util do
Enum.map(0..(n - 1), &fun.(&1))
end

@spec list(integer, (() -> any)) :: [any]
@spec list(integer, (-> any)) :: [any]
def list(n, fun) when is_function(fun, 0) do
Enum.map(0..(n - 1), fn _ -> fun.() end)
end
Expand All @@ -103,7 +103,7 @@ defmodule Faker.Util do
iex> Faker.Util.join(2, " or ", &Faker.Color.name/0)
"Purple or White"
"""
@spec join(integer, binary, (() -> binary)) :: binary
@spec join(integer, binary, (-> binary)) :: binary
def join(n, joiner \\ "", fun) do
Enum.join(list(n, fun), joiner)
end
Expand Down

0 comments on commit a97c300

Please sign in to comment.