content
stringlengths 10
4.9M
|
---|
/* Returns true if there is one pointer type in TYPE_POINTER_TO (SRC_OBJ)
list of pointer-to types that is trivially convertible to DEST. */
static bool
one_pointer_to_useless_type_conversion_p (tree dest, tree src_obj)
{
tree src;
if (!TYPE_POINTER_TO (src_obj))
return true;
for (src = TYPE_POINTER_TO (src_obj); src; src = TYPE_NEXT_PTR_TO (src))
if (useless_type_conversion_p (dest, src))
return true;
return false;
} |
module Util.Internal.Indexed where
-- | > Compose (State Int) f a
newtype Indexed f a = Indexed { runIndexed :: Int -> (f a, Int) }
instance Functor f => Functor (Indexed f) where
fmap f (Indexed sf) = Indexed $ \s -> let (x, s') = sf s in (fmap f x, s')
instance Applicative f => Applicative (Indexed f) where
pure x = Indexed $ (,) (pure x)
Indexed sfa <*> Indexed sfb = Indexed $ \s ->
let (f, s') = sfa s
(x, s'') = sfb s'
in (f <*> x, s'')
evalIndexed :: Indexed f a -> Int -> f a
evalIndexed (Indexed sf) x = fst (sf x)
|
// load_spectra takes a spectrum file path, reads the spectra and stores the relevant information
// in a vector of spectrum objects
class load_spectra
{
public:
load_spectra(void) {
validation = "";
skipped = 0;
}
virtual ~load_spectra(void) {}
bool load(map<string,string>& _p,load_kernel& _lk);
bool load_mgf(map<string,string>& _p,load_kernel& _lk);
bool load_cmn(map<string,string>& _p,load_kernel& _lk);
void set_max(const int32_t _max) {
if(spectra.size() <= (size_t)_max) {
return;
}
spectra.erase(spectra.begin()+_max,spectra.end());
return;
}
void clean_up(void) {
spectra.clear();
spectra.shrink_to_fit();
}
vector<spectrum> spectra;
string validation;
int32_t skipped;
} |
Russian Central Bank Pivots on Cryptocurrency Stance, Endorses Crypto-ruble
The Russian Central Bank has recently indicated that it is currently considering launching a national cryptocurrency following First Deputy Prime Minister Igor Shuvalov’s support for introducing a “Crypto-ruble.”
Olga Skorobogatova, deputy chief of the Bank of Russia, has recently made statements at a press conference for the Finopolis Forum of Innovative Financial Technologies in favor of creating a Russian national cryptocurrency. In the announcement, Skorobogatova indicated that “the creation of a national cryptocurrency stimulates the growth of non-cash payments and electronic payments, including, possibly, cross-border payments.”
Skorobogatova’s statements echo her earlier comments at the St. Petersburg International Economic Forum in June this year, in which she remarked that Russia desires to “jointly test blockchain for cooperating with EU countries on the projects we’re going to start this year.”
In her more recent press conference, Skorobogatova commented on the utility of cryptocurrencies in fostering increased use of digital transactions:
“It is becoming more convenient for all users to pay for goods and services through electronic wallets, and the digital currency can play the role of a catalyst for using it for payments in a broader sense.”
Embracing a Crypto Finance Education Strategy
In her address, the deputy chief also referenced the impending crypto financial education program that will be a focus for the bank moving forward, citing a recent case of fake bitcoin sales allegedly sold in Obninsk, southwest of Moscow. The Russian Central Bank’s Head of Consumer Protection Services, Mikhail Mamut, announced at the conference that “The Central Bank will pay more attention to increasing financial literacy in this area in order to minimize basic mistakes.”
The Russian Ministry of Finance has recently approved the incorporation of cryptocurrency into the country’s financial literacy strategy. Minister of Finance Anton Siluanov has stated in a broadcast on TV channel “Russia 24” that it is necessary to include the topic of cryptocurrency to improve the financial literacy of Russians:
“The question of investing in instruments such as cryptocurrencies will, of course, be discussed, and we now see more risks than recommendations on investing in such instruments. So, explaining the possible consequences of investing in unregulated instruments will be one of the issues with which we will speak for the current year and until 2023.”
Russia Opposes Bitcoin
The recent indications that Russia may be introducing a state-backed cryptocurrency are at odds with recent condemnations of other cryptocurrencies such as bitcoin. The Russian Central Bank has previously taken a hardline stance to the use of digital currencies, stating “Concerning the use of cryptocurrency, according to the current legislation, the official currency of the Russian Federation is the ruble. The issue of monetary surrogates in the territory of the Russian Federation is not allowed.”
Given the recent statements made First Deputy Prime Minister Igor Shuvalov in his support of the creation of a state-backed Crypto-Ruble, it’s clear that the Russian government desires promote the integration of blockchain technology into a state-controlled apparatus, rather than oppose it directly. This is further indicated by comments from Russian President Vladimir Putin on October 10:
“We need – based on international experience – to build a regulatory environment that will make it possible to codify relations in this sphere, reliably protect the interests of citizens, businesses, and the state and provide legal guarantees for using innovative financial instruments.”
In the meeting with Russia’s finance minister and central bank governors, Putin stated, “I would like once again to draw your attention to the need to use the advantages that are offered by new technological solutions in the banking sphere. At the same time, it is important not to create unnecessary barriers, of course, but rather to provide essential conditions for advancing and upgrading the national financial system.” |
def add_get(self, coin):
if coin.symbol is None or len(coin.symbol) == 0:
raise Exception("coin could not be added because it symbol was missing")
if coin.hash_value is None or len(coin.hash_value) == 0:
coin.hash_value = self.hash(coin.symbol)
if not self.coin_exist(coin):
self.active_session.add(coin)
self.active_session.commit()
return coin |
// InputStream is passed for XmlStreamReaderException creation only
private String calculateHttpEncoding(final String cTMime, final String cTEnc, final String bomEnc, final String xmlGuessEnc, final String xmlEnc, final InputStream is,
final boolean lenient)
throws IOException {
String encoding;
if (lenient && xmlEnc != null) {
encoding = xmlEnc;
} else {
final boolean appXml = isAppXml(cTMime);
final boolean textXml = isTextXml(cTMime);
if (appXml || textXml) {
if (cTEnc == null) {
if (appXml) {
encoding = calculateRawEncoding(bomEnc, xmlGuessEnc, xmlEnc, is);
} else {
if (defaultEncoding == null) {
encoding = US_ASCII;
} else {
encoding = defaultEncoding;
}
}
} else if (bomEnc != null && (cTEnc.equals(UTF_16BE) || cTEnc.equals(UTF_16LE))) {
throw new XmlStreamReaderException(HTTP_EX_1.format(new Object[] {cTMime, cTEnc, bomEnc, xmlGuessEnc, xmlEnc}), cTMime, cTEnc, bomEnc, xmlGuessEnc, xmlEnc, is);
} else if (cTEnc.equals(UTF_16)) {
if (bomEnc != null && bomEnc.startsWith(UTF_16)) {
encoding = bomEnc;
} else {
throw new XmlStreamReaderException(HTTP_EX_2.format(new Object[] {cTMime, cTEnc, bomEnc, xmlGuessEnc, xmlEnc}), cTMime, cTEnc, bomEnc, xmlGuessEnc, xmlEnc,
is);
}
} else {
encoding = cTEnc;
}
} else {
throw new XmlStreamReaderException(HTTP_EX_3.format(new Object[] {cTMime, cTEnc, bomEnc, xmlGuessEnc, xmlEnc}), cTMime, cTEnc, bomEnc, xmlGuessEnc, xmlEnc, is);
}
}
return encoding;
} |
It started out as a simple gesture of appreciation. It turned into something much more special.
Will Bolton is beloved by everyone at Franklin Co. High School. The school’s football manager for three seasons and the basketball manager for two, Bolton couldn’t play football or basketball because of scoliosis.
"I enjoy the sport a lot because that is the time of year I wish I could put a jersey on for anything. I'd give anything to put a jersey on,” Bolton said.
"Will is one of those kids, that the only way I can describe him is, if you don't like Will, then the problem is probably with you," Franklin Co. basketball coach Tony Wise.
Wise brought Will, a senior, and the rest of the team, into the locker room on Wednesday to discuss Thursday's Senior Night festivities. Wise surprised Bolton and the team with the announcement that Bolton would suit up for the Flyers.
Bolton was ecstatic.
“Looks like I’m getting some playing time tomorrow, boys,” Bolton shouted to his teammates. Flyers players and Wise celebrated.
On game night, it didn’t take Bolton long to get into his Franklin Co. uniform.
"I know what it means to him, or at least I thought I did," Wise said.
Wise also had some pregame advice for Bolton.
"Just imagine that our gym is your driveway. You've told us you're 99-0 at home.”
“No one takes me out on my driveway,” Bolton answered.
Bolton predicted before the game that he’d hit a three-pointer. As fate would have it, after missing his first four shots, Bolt nailed a three.
Franklin Co.'s gym erupted.
Bolton played two minutes and scored three points, in one of the biggest moment's of his life.
The Flyers would go on to win on Senior Night and Bolton’s dreams of wearing a jersey and playing for Flyers had come true. |
“Theater is as big an interest in my life — interest meaning something I love — as movies or as music,” he said. “They’ve always been equal. And therefore it occurred to me: Why not combine music and theater? That’s called musical theater!” And to boot, he added, “I was brought up by Oscar.”
As Sondheim fans know well, he was referring to the lyricist Oscar Hammerstein II, who became not just his mentor but also a kind of surrogate father after his parents divorced and his mother moved with her only child from the Upper West Side of Manhattan to rural Pennsylvania.
Mr. Sondheim was 11 when he met Hammerstein and his family. For five years, this musical theater giant gave him invaluable insights into the art form. “Oscar — let’s not say he was a poet — was a lyricist and a playwright,” Mr. Sondheim said. “Why wasn’t he a novelist? Because he loved the theater!” That’s the “simple answer,” Mr. Sondheim said, to the question I raised.
Mr. Sondheim’s musical training, such as it was, started early.
“When I was 7 years old, like all nice Jewish boys on the Upper West Side, I took piano lessons,” he said. “When my parents had company over for cocktails, I would be trotted out to play ‘Flight of the Bumblebee’ because I had a very good right hand.” (His left hand, he asserted, was “a lox.”)
He recounted playing little pieces by Schumann and other works for the kiddie recitals that Mrs. Moss, his piano teacher, regularly organized. Later, when he attended a Quaker private school, a faculty member intent on cultivating his piano skills performed two-piano arrangements of concertos with him, including the first movement of Rachmaninoff’s Second Concerto, a piece that requires considerable skill from the soloist. (His left hand couldn’t have been all that recalcitrant.) |
EPA/Alamy
Pablo Echenique has an unusual profile for a newly elected Member of the European Parliament (MEP). The Argentinian-born Spaniard is a researcher in chemical physics at the Spanish National Research Council in Zaragoza (CSIC), and until six months ago had no plans to run in elections.
Echenique is one of the few MEPs with a disability — in his case, spinal muscular atrophy. He is part of Podemos ('We can'), a left-wing party that, a mere four months after being founded, surprised Spain by winning more than 1 million votes and five MEPs in the European Parliament elections last month. Some portray the party as a populist group, and others as a challenger to the country's staid political system.
Echenique, 35, whose research focused on hybrid classical–quantum models, is also a contributor to a blog that deals with disability with a humorous twist. Here, he speaks to Nature about his party's plans, centralizing European research and transgenic organisms.
What is your field of research?
I work on computation models of organic molecules that mix classical and quantum physics. One of my main results was a model I developed with colleagues in 2008, which is a competitor to the most popular model in the field.
How has your disability affected your research career?
Positively. I have no sporting hobbies, so I have had more time to read and study. I have not experienced discrimination in the scientific world. The state in Spain discriminates against people with disabilities because it does not provide enough resources to fulfil their needs — but individuals are willing to help, most of the time.
Why did you enter politics?
I was indignant because in Spain and other countries there are growing numbers of poor people, while we see more and more millionaires and politicians involved in corruption cases. That is what spurred me to join Podemos. I won in the party's primary elections for the European Parliament, thanks to the support of the people in [Zaragoza] and the popularity of my blog. The MEPs from Podemos have not had much time to make plans in the last few months, and I feel a sense of vertigo because I am taking on a big responsibility. But I don't think that other MEPs are more prepared than us.
Do you plan to keep doing science while you are a Member of the European Parliament?
It is impossible — I will have to take leave. Podemos MEPs have committed to limit our stay in the Parliament to a maximum of two mandates. I see this political experience as an act of responsibility, but I prefer science.
Did Spain's budget cuts to science influence your decision to run for the European Parliament?
My concerns are more general. I think that science is essential for a developed country, and Spain needs a powerful, public, high-quality system. My salary was cut, like those of many other scientists. But before making last-generation medicines or high-temperature superconductors, people need to eat. We need to fix the disaster of research and development [funding] in Spain, but I am more concerned about people who cannot pay to heat their homes. Science funding is often justified by saying that we should invest in research because it is profitable: this argument scares me a little. For example, investing in disability is not profitable, but it is still necessary. That argument is correct, but profitability should not be the only objective. Knowledge should be supported for its own sake.
Podemos’s electoral programme makes very few proposals about research and development. Should it have done more?
We drafted the programme in a collaborative fashion. This is a good method of developing a programme, but it can have imperfect outcomes if it is done in short time, as we did. Now we have set up new circles [Podemos is organized in working groups called 'circles'] devoted to science, to correct the shortcomings of the programme before the next round of elections in Spain. I am strongly committed to improve Podemos’s proposals on science. Our main objective is to bring Spain up to the European average in terms of science funding. We want a homogenous system for science in Europe, not one in which northern European countries are specialized in science and technology and southern countries in services like tourism. We are aware that the current majority in the European Parliament is not committed to this vision. However, we hope that we can at least set an example of another way of doing politics, by being honest, cutting Podemos’s MEP salaries by three-quarters, limiting the number of mandates, and informing citizens about what lobbies do in the Parliament.
Podemos’s programme states that genetically modified organisms (GMOs) should be banned in Europe. Do you stand by this position?
I opposed that part of the programme, but it was approved by Podemos's majority. I think this point should be improved, and I will not support something as simplistic as banning GMOs altogether. I think that GMOs are not bad in and of themselves. There are people on the left with anti-scientific positions, just as there are on the right. However, sometimes scientists naively think that there are issues that don’t have a social dimension, and that only they — not the majority of people — are qualified to establish policies on these issues. GMOs have social and economic dimensions as well as scientific ones: for example, companies that monopolize technologies and that are unethical towards farmers.
Do you have specific proposals regarding disability?
Travelling on an aeroplane is a nightmare for a disabled person. You are forced to leave the wheelchair — which is stored away and might get damaged during the flight — and you are forced to stay in uncomfortable seats. I think that there may be some consensus in the European Parliament towards changing the regulations to avoid this. |
<reponame>kampff-lab/videogame-assay
#
# Module providing the `Process` class which emulates `threading.Thread`
#
# multiprocessing/process.py
#
# Copyright (c) 2006-2008, <NAME>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# 3. Neither the name of author nor the names of any contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
__all__ = ['Process', 'current_process', 'active_children']
#
# Imports
#
import os
import sys
import signal
import itertools
#
#
#
try:
ORIGINAL_DIR = os.path.abspath(os.getcwd())
except OSError:
ORIGINAL_DIR = None
#
# Public functions
#
def current_process():
'''
Return process object representing the current process
'''
return _current_process
def active_children():
'''
Return list of process objects corresponding to live child processes
'''
_cleanup()
return list(_current_process._children)
#
#
#
def _cleanup():
# check for processes which have finished
for p in list(_current_process._children):
if p._popen.poll() is not None:
_current_process._children.discard(p)
#
# The `Process` class
#
class Process(object):
'''
Process objects represent activity that is run in a separate process
The class is analagous to `threading.Thread`
'''
_Popen = None
def __init__(self, group=None, target=None, name=None, args=(), kwargs={}):
assert group is None, 'group argument must be None for now'
count = _current_process._counter.next()
self._identity = _current_process._identity + (count,)
self._authkey = _current_process._authkey
self._daemonic = _current_process._daemonic
self._tempdir = _current_process._tempdir
self._parent_pid = os.getpid()
self._popen = None
self._target = target
self._args = tuple(args)
self._kwargs = dict(kwargs)
self._name = name or type(self).__name__ + '-' + \
':'.join(str(i) for i in self._identity)
def run(self):
'''
Method to be run in sub-process; can be overridden in sub-class
'''
if self._target:
self._target(*self._args, **self._kwargs)
def start(self):
'''
Start child process
'''
assert self._popen is None, 'cannot start a process twice'
assert self._parent_pid == os.getpid(), \
'can only start a process object created by current process'
assert not _current_process._daemonic, \
'daemonic processes are not allowed to have children'
_cleanup()
if self._Popen is not None:
Popen = self._Popen
else:
from .forking import Popen
self._popen = Popen(self)
_current_process._children.add(self)
def terminate(self):
'''
Terminate process; sends SIGTERM signal or uses TerminateProcess()
'''
self._popen.terminate()
def join(self, timeout=None):
'''
Wait until child process terminates
'''
assert self._parent_pid == os.getpid(), 'can only join a child process'
assert self._popen is not None, 'can only join a started process'
res = self._popen.wait(timeout)
if res is not None:
_current_process._children.discard(self)
def is_alive(self):
'''
Return whether process is alive
'''
if self is _current_process:
return True
assert self._parent_pid == os.getpid(), 'can only test a child process'
if self._popen is None:
return False
self._popen.poll()
return self._popen.returncode is None
@property
def name(self):
return self._name
@name.setter
def name(self, name):
assert isinstance(name, basestring), 'name must be a string'
self._name = name
@property
def daemon(self):
'''
Return whether process is a daemon
'''
return self._daemonic
@daemon.setter
def daemon(self, daemonic):
'''
Set whether process is a daemon
'''
assert self._popen is None, 'process has already started'
self._daemonic = daemonic
@property
def authkey(self):
return self._authkey
@authkey.setter
def authkey(self, authkey):
'''
Set authorization key of process
'''
self._authkey = AuthenticationString(authkey)
@property
def exitcode(self):
'''
Return exit code of process or `None` if it has yet to stop
'''
if self._popen is None:
return self._popen
return self._popen.poll()
@property
def ident(self):
'''
Return identifier (PID) of process or `None` if it has yet to start
'''
if self is _current_process:
return os.getpid()
else:
return self._popen and self._popen.pid
pid = ident
def __repr__(self):
if self is _current_process:
status = 'started'
elif self._parent_pid != os.getpid():
status = 'unknown'
elif self._popen is None:
status = 'initial'
else:
if self._popen.poll() is not None:
status = self.exitcode
else:
status = 'started'
if type(status) is int:
if status == 0:
status = 'stopped'
else:
status = 'stopped[%s]' % _exitcode_to_name.get(status, status)
return '<%s(%s, %s%s)>' % (type(self).__name__, self._name,
status, self._daemonic and ' daemon' or '')
##
def _bootstrap(self):
from . import util
global _current_process
try:
self._children = set()
self._counter = itertools.count(1)
try:
sys.stdin.close()
sys.stdin = open(os.devnull)
except (OSError, ValueError):
pass
_current_process = self
util._finalizer_registry.clear()
util._run_after_forkers()
util.info('child process calling self.run()')
try:
self.run()
exitcode = 0
finally:
util._exit_function()
except SystemExit, e:
if not e.args:
exitcode = 1
elif type(e.args[0]) is int:
exitcode = e.args[0]
else:
sys.stderr.write(e.args[0] + '\n')
sys.stderr.flush()
exitcode = 1
except:
exitcode = 1
import traceback
sys.stderr.write('Process %s:\n' % self.name)
sys.stderr.flush()
traceback.print_exc()
util.info('process exiting with exitcode %d' % exitcode)
return exitcode
#
# We subclass bytes to avoid accidental transmission of auth keys over network
#
class AuthenticationString(bytes):
def __reduce__(self):
from .forking import Popen
if not Popen.thread_is_spawning():
raise TypeError(
'Pickling an AuthenticationString object is '
'disallowed for security reasons'
)
return AuthenticationString, (bytes(self),)
#
# Create object representing the main process
#
class _MainProcess(Process):
def __init__(self):
self._identity = ()
self._daemonic = False
self._name = 'MainProcess'
self._parent_pid = None
self._popen = None
self._counter = itertools.count(1)
self._children = set()
self._authkey = AuthenticationString(bytes(os.urandom(32), 'latin-1'))
self._tempdir = None
_current_process = _MainProcess()
del _MainProcess
#
# Give names to some return codes
#
_exitcode_to_name = {}
for name, signum in signal.__dict__.items():
if name[:3]=='SIG' and '_' not in name:
_exitcode_to_name[-signum] = name
|
<filename>Creational/builder/builder_test.go
package builder
import "testing"
func Test01(t *testing.T) {
burderBuilder := &BurgerBuilder{}
burderBuilder.size = 14
burderBuilder.addTomato()
burger := burderBuilder.build()
t.Logf("Burger's tomato: %v", burger.tomato)
}
|
<reponame>cloudify-cosmo/cloudify-plugin
package co.cloudify.jenkins.plugin.callables;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.nio.charset.StandardCharsets;
import javax.json.JsonObject;
import org.jenkinsci.remoting.RoleChecker;
import co.cloudify.jenkins.plugin.CloudifyPluginUtilities;
import hudson.FilePath.FileCallable;
import hudson.remoting.VirtualChannel;
public class JsonFileWriterFileCallable implements FileCallable<Void> {
/** Serialization UID. */
private static final long serialVersionUID = 1L;
private JsonObject json;
public JsonFileWriterFileCallable(final JsonObject json) {
this.json = json;
}
@Override
public void checkRoles(RoleChecker checker) throws SecurityException {
// Nothing.
}
@Override
public Void invoke(File f, VirtualChannel channel) throws IOException, InterruptedException {
try (FileOutputStream fos = new FileOutputStream(f);
OutputStreamWriter osw = new OutputStreamWriter(fos, StandardCharsets.UTF_8)) {
osw.write(CloudifyPluginUtilities.toString(json));
}
return null;
}
}
|
package fp
import (
_ "errors"
"reflect"
"testing"
)
func TestPmapIntInt64Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []int64{2, 3}
newList, _ := PMapIntInt64Err(plusOneIntInt64Err, []int{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapIntInt64 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapIntInt64Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapIntInt64Err failed")
}
r, _ = PMapIntInt64Err(nil, []int{})
if len(r) > 0 {
t.Errorf("PMapIntInt64Err failed")
}
_, err := PMapIntInt64Err(plusOneIntInt64Err, []int{1, 2, 3})
if err == nil {
t.Errorf("PMapIntInt64Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapIntInt64Err(plusOneIntInt64Err, []int{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapIntInt64Err failed")
}
_, err = PMapIntInt64Err(plusOneIntInt64Err, []int{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapIntInt64Err failed")
}
_, err = PMapIntInt64Err(plusOneIntInt64Err, []int{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapIntInt64Err failed")
}
_, err = PMapIntInt64Err(plusOneIntInt64Err, []int{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapIntInt64Err failed")
}
expectedList = []int64{2, 3}
newList, _ = PMapIntInt64Err(plusOneIntInt64Err, []int{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapIntInt64 failed")
}
_, err = PMapIntInt64Err(plusOneIntInt64Err, []int{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntInt64Err failed")
}
_, err = PMapIntInt64Err(plusOneIntInt64Err, []int{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntInt64Err failed")
}
_, err = PMapIntInt64Err(plusOneIntInt64Err, []int{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntInt64Err failed")
}
_, err = PMapIntInt64Err(plusOneIntInt64Err, []int{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntInt64Err failed")
}
_, err = PMapIntInt64Err(plusOneIntInt64Err, []int{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntInt64Err failed")
}
}
func TestPmapIntInt32Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []int32{2, 3}
newList, _ := PMapIntInt32Err(plusOneIntInt32Err, []int{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapIntInt32 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapIntInt32Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapIntInt32Err failed")
}
r, _ = PMapIntInt32Err(nil, []int{})
if len(r) > 0 {
t.Errorf("PMapIntInt32Err failed")
}
_, err := PMapIntInt32Err(plusOneIntInt32Err, []int{1, 2, 3})
if err == nil {
t.Errorf("PMapIntInt32Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapIntInt32Err(plusOneIntInt32Err, []int{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapIntInt32Err failed")
}
_, err = PMapIntInt32Err(plusOneIntInt32Err, []int{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapIntInt32Err failed")
}
_, err = PMapIntInt32Err(plusOneIntInt32Err, []int{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapIntInt32Err failed")
}
_, err = PMapIntInt32Err(plusOneIntInt32Err, []int{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapIntInt32Err failed")
}
expectedList = []int32{2, 3}
newList, _ = PMapIntInt32Err(plusOneIntInt32Err, []int{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapIntInt32 failed")
}
_, err = PMapIntInt32Err(plusOneIntInt32Err, []int{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntInt32Err failed")
}
_, err = PMapIntInt32Err(plusOneIntInt32Err, []int{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntInt32Err failed")
}
_, err = PMapIntInt32Err(plusOneIntInt32Err, []int{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntInt32Err failed")
}
_, err = PMapIntInt32Err(plusOneIntInt32Err, []int{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntInt32Err failed")
}
_, err = PMapIntInt32Err(plusOneIntInt32Err, []int{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntInt32Err failed")
}
}
func TestPmapIntInt16Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []int16{2, 3}
newList, _ := PMapIntInt16Err(plusOneIntInt16Err, []int{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapIntInt16 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapIntInt16Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapIntInt16Err failed")
}
r, _ = PMapIntInt16Err(nil, []int{})
if len(r) > 0 {
t.Errorf("PMapIntInt16Err failed")
}
_, err := PMapIntInt16Err(plusOneIntInt16Err, []int{1, 2, 3})
if err == nil {
t.Errorf("PMapIntInt16Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapIntInt16Err(plusOneIntInt16Err, []int{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapIntInt16Err failed")
}
_, err = PMapIntInt16Err(plusOneIntInt16Err, []int{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapIntInt16Err failed")
}
_, err = PMapIntInt16Err(plusOneIntInt16Err, []int{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapIntInt16Err failed")
}
_, err = PMapIntInt16Err(plusOneIntInt16Err, []int{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapIntInt16Err failed")
}
expectedList = []int16{2, 3}
newList, _ = PMapIntInt16Err(plusOneIntInt16Err, []int{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapIntInt16 failed")
}
_, err = PMapIntInt16Err(plusOneIntInt16Err, []int{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntInt16Err failed")
}
_, err = PMapIntInt16Err(plusOneIntInt16Err, []int{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntInt16Err failed")
}
_, err = PMapIntInt16Err(plusOneIntInt16Err, []int{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntInt16Err failed")
}
_, err = PMapIntInt16Err(plusOneIntInt16Err, []int{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntInt16Err failed")
}
_, err = PMapIntInt16Err(plusOneIntInt16Err, []int{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntInt16Err failed")
}
}
func TestPmapIntInt8Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []int8{2, 3}
newList, _ := PMapIntInt8Err(plusOneIntInt8Err, []int{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapIntInt8 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapIntInt8Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapIntInt8Err failed")
}
r, _ = PMapIntInt8Err(nil, []int{})
if len(r) > 0 {
t.Errorf("PMapIntInt8Err failed")
}
_, err := PMapIntInt8Err(plusOneIntInt8Err, []int{1, 2, 3})
if err == nil {
t.Errorf("PMapIntInt8Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapIntInt8Err(plusOneIntInt8Err, []int{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapIntInt8Err failed")
}
_, err = PMapIntInt8Err(plusOneIntInt8Err, []int{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapIntInt8Err failed")
}
_, err = PMapIntInt8Err(plusOneIntInt8Err, []int{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapIntInt8Err failed")
}
_, err = PMapIntInt8Err(plusOneIntInt8Err, []int{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapIntInt8Err failed")
}
expectedList = []int8{2, 3}
newList, _ = PMapIntInt8Err(plusOneIntInt8Err, []int{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapIntInt8 failed")
}
_, err = PMapIntInt8Err(plusOneIntInt8Err, []int{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntInt8Err failed")
}
_, err = PMapIntInt8Err(plusOneIntInt8Err, []int{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntInt8Err failed")
}
_, err = PMapIntInt8Err(plusOneIntInt8Err, []int{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntInt8Err failed")
}
_, err = PMapIntInt8Err(plusOneIntInt8Err, []int{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntInt8Err failed")
}
_, err = PMapIntInt8Err(plusOneIntInt8Err, []int{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntInt8Err failed")
}
}
func TestPmapIntUintErr(t *testing.T) {
// Test : add 1 to the list
expectedList := []uint{2, 3}
newList, _ := PMapIntUintErr(plusOneIntUintErr, []int{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapIntUint failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapIntUintErr(nil, nil)
if len(r) > 0 {
t.Errorf("PMapIntUintErr failed")
}
r, _ = PMapIntUintErr(nil, []int{})
if len(r) > 0 {
t.Errorf("PMapIntUintErr failed")
}
_, err := PMapIntUintErr(plusOneIntUintErr, []int{1, 2, 3})
if err == nil {
t.Errorf("PMapIntUintErr failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapIntUintErr(plusOneIntUintErr, []int{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapIntUintErr failed")
}
_, err = PMapIntUintErr(plusOneIntUintErr, []int{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapIntUintErr failed")
}
_, err = PMapIntUintErr(plusOneIntUintErr, []int{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapIntUintErr failed")
}
_, err = PMapIntUintErr(plusOneIntUintErr, []int{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapIntUintErr failed")
}
expectedList = []uint{2, 3}
newList, _ = PMapIntUintErr(plusOneIntUintErr, []int{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapIntUint failed")
}
_, err = PMapIntUintErr(plusOneIntUintErr, []int{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntUintErr failed")
}
_, err = PMapIntUintErr(plusOneIntUintErr, []int{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntUintErr failed")
}
_, err = PMapIntUintErr(plusOneIntUintErr, []int{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntUintErr failed")
}
_, err = PMapIntUintErr(plusOneIntUintErr, []int{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntUintErr failed")
}
_, err = PMapIntUintErr(plusOneIntUintErr, []int{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntUintErr failed")
}
}
func TestPmapIntUint64Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []uint64{2, 3}
newList, _ := PMapIntUint64Err(plusOneIntUint64Err, []int{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapIntUint64 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapIntUint64Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapIntUint64Err failed")
}
r, _ = PMapIntUint64Err(nil, []int{})
if len(r) > 0 {
t.Errorf("PMapIntUint64Err failed")
}
_, err := PMapIntUint64Err(plusOneIntUint64Err, []int{1, 2, 3})
if err == nil {
t.Errorf("PMapIntUint64Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapIntUint64Err(plusOneIntUint64Err, []int{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapIntUint64Err failed")
}
_, err = PMapIntUint64Err(plusOneIntUint64Err, []int{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapIntUint64Err failed")
}
_, err = PMapIntUint64Err(plusOneIntUint64Err, []int{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapIntUint64Err failed")
}
_, err = PMapIntUint64Err(plusOneIntUint64Err, []int{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapIntUint64Err failed")
}
expectedList = []uint64{2, 3}
newList, _ = PMapIntUint64Err(plusOneIntUint64Err, []int{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapIntUint64 failed")
}
_, err = PMapIntUint64Err(plusOneIntUint64Err, []int{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntUint64Err failed")
}
_, err = PMapIntUint64Err(plusOneIntUint64Err, []int{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntUint64Err failed")
}
_, err = PMapIntUint64Err(plusOneIntUint64Err, []int{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntUint64Err failed")
}
_, err = PMapIntUint64Err(plusOneIntUint64Err, []int{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntUint64Err failed")
}
_, err = PMapIntUint64Err(plusOneIntUint64Err, []int{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntUint64Err failed")
}
}
func TestPmapIntUint32Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []uint32{2, 3}
newList, _ := PMapIntUint32Err(plusOneIntUint32Err, []int{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapIntUint32 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapIntUint32Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapIntUint32Err failed")
}
r, _ = PMapIntUint32Err(nil, []int{})
if len(r) > 0 {
t.Errorf("PMapIntUint32Err failed")
}
_, err := PMapIntUint32Err(plusOneIntUint32Err, []int{1, 2, 3})
if err == nil {
t.Errorf("PMapIntUint32Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapIntUint32Err(plusOneIntUint32Err, []int{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapIntUint32Err failed")
}
_, err = PMapIntUint32Err(plusOneIntUint32Err, []int{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapIntUint32Err failed")
}
_, err = PMapIntUint32Err(plusOneIntUint32Err, []int{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapIntUint32Err failed")
}
_, err = PMapIntUint32Err(plusOneIntUint32Err, []int{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapIntUint32Err failed")
}
expectedList = []uint32{2, 3}
newList, _ = PMapIntUint32Err(plusOneIntUint32Err, []int{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapIntUint32 failed")
}
_, err = PMapIntUint32Err(plusOneIntUint32Err, []int{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntUint32Err failed")
}
_, err = PMapIntUint32Err(plusOneIntUint32Err, []int{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntUint32Err failed")
}
_, err = PMapIntUint32Err(plusOneIntUint32Err, []int{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntUint32Err failed")
}
_, err = PMapIntUint32Err(plusOneIntUint32Err, []int{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntUint32Err failed")
}
_, err = PMapIntUint32Err(plusOneIntUint32Err, []int{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntUint32Err failed")
}
}
func TestPmapIntUint16Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []uint16{2, 3}
newList, _ := PMapIntUint16Err(plusOneIntUint16Err, []int{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapIntUint16 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapIntUint16Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapIntUint16Err failed")
}
r, _ = PMapIntUint16Err(nil, []int{})
if len(r) > 0 {
t.Errorf("PMapIntUint16Err failed")
}
_, err := PMapIntUint16Err(plusOneIntUint16Err, []int{1, 2, 3})
if err == nil {
t.Errorf("PMapIntUint16Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapIntUint16Err(plusOneIntUint16Err, []int{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapIntUint16Err failed")
}
_, err = PMapIntUint16Err(plusOneIntUint16Err, []int{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapIntUint16Err failed")
}
_, err = PMapIntUint16Err(plusOneIntUint16Err, []int{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapIntUint16Err failed")
}
_, err = PMapIntUint16Err(plusOneIntUint16Err, []int{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapIntUint16Err failed")
}
expectedList = []uint16{2, 3}
newList, _ = PMapIntUint16Err(plusOneIntUint16Err, []int{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapIntUint16 failed")
}
_, err = PMapIntUint16Err(plusOneIntUint16Err, []int{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntUint16Err failed")
}
_, err = PMapIntUint16Err(plusOneIntUint16Err, []int{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntUint16Err failed")
}
_, err = PMapIntUint16Err(plusOneIntUint16Err, []int{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntUint16Err failed")
}
_, err = PMapIntUint16Err(plusOneIntUint16Err, []int{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntUint16Err failed")
}
_, err = PMapIntUint16Err(plusOneIntUint16Err, []int{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntUint16Err failed")
}
}
func TestPmapIntUint8Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []uint8{2, 3}
newList, _ := PMapIntUint8Err(plusOneIntUint8Err, []int{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapIntUint8 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapIntUint8Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapIntUint8Err failed")
}
r, _ = PMapIntUint8Err(nil, []int{})
if len(r) > 0 {
t.Errorf("PMapIntUint8Err failed")
}
_, err := PMapIntUint8Err(plusOneIntUint8Err, []int{1, 2, 3})
if err == nil {
t.Errorf("PMapIntUint8Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapIntUint8Err(plusOneIntUint8Err, []int{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapIntUint8Err failed")
}
_, err = PMapIntUint8Err(plusOneIntUint8Err, []int{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapIntUint8Err failed")
}
_, err = PMapIntUint8Err(plusOneIntUint8Err, []int{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapIntUint8Err failed")
}
_, err = PMapIntUint8Err(plusOneIntUint8Err, []int{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapIntUint8Err failed")
}
expectedList = []uint8{2, 3}
newList, _ = PMapIntUint8Err(plusOneIntUint8Err, []int{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapIntUint8 failed")
}
_, err = PMapIntUint8Err(plusOneIntUint8Err, []int{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntUint8Err failed")
}
_, err = PMapIntUint8Err(plusOneIntUint8Err, []int{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntUint8Err failed")
}
_, err = PMapIntUint8Err(plusOneIntUint8Err, []int{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntUint8Err failed")
}
_, err = PMapIntUint8Err(plusOneIntUint8Err, []int{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntUint8Err failed")
}
_, err = PMapIntUint8Err(plusOneIntUint8Err, []int{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntUint8Err failed")
}
}
func TestPmapIntStrErr(t *testing.T) {
// Test : someLogic
expectedList := []string{"10"}
newList, _ := PMapIntStrErr(someLogicIntStrErr, []int{10})
if newList[0] != expectedList[0] {
t.Errorf("PMapIntStrErr failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapIntStrErr(nil, nil)
if len(r) > 0 {
t.Errorf("PMapIntStrErr failed")
}
r, _ = PMapIntStrErr(nil, []int{})
if len(r) > 0 {
t.Errorf("PMapIntStrErr failed")
}
_, err := PMapIntStrErr(someLogicIntStrErr, []int{10, 0})
if err == nil {
t.Errorf("PMapIntStrErr failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapIntStrErr(someLogicIntStrErr, []int{10, 10, 0}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapIntStrErr failed")
}
_, err = PMapIntStrErr(someLogicIntStrErr, []int{0, 0, 10}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapIntStrErr failed")
}
_, err = PMapIntStrErr(someLogicIntStrErr, []int{0, 10, 0}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapIntStrErr failed")
}
_, err = PMapIntStrErr(someLogicIntStrErr, []int{10, 10, 0}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapIntStrErr failed")
}
expectedList = []string{"10", "10"}
newList, _ = PMapIntStrErr(someLogicIntStrErr, []int{10, 10}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapIntStr failed")
}
_, err = PMapIntStrErr(someLogicIntStrErr, []int{10, 10, 0}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntStrErr failed")
}
_, err = PMapIntStrErr(someLogicIntStrErr, []int{10, 10, 0}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntStrErr failed")
}
_, err = PMapIntStrErr(someLogicIntStrErr, []int{0, 0, 10}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntStrErr failed")
}
_, err = PMapIntStrErr(someLogicIntStrErr, []int{0, 10, 0}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntStrErr failed")
}
_, err = PMapIntStrErr(someLogicIntStrErr, []int{10, 10, 0}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntStrErr failed")
}
}
func TestPmapIntBoolErr(t *testing.T) {
// Test : someLogic
expectedList := []bool{true, false}
newList, _ := PMapIntBoolErr(someLogicIntBoolErr, []int{10, 0})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapIntBoolErr failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapIntBoolErr(nil, nil)
if len(r) > 0 {
t.Errorf("PMapIntBoolErr failed")
}
r, _ = PMapIntBoolErr(nil, []int{})
if len(r) > 0 {
t.Errorf("PMapIntBoolErr failed")
}
_, err := PMapIntBoolErr(someLogicIntBoolErr, []int{10, 3, 3})
if err == nil {
t.Errorf("PMapIntBoolErr failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapIntBoolErr(someLogicIntBoolErr, []int{10, 10, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapIntBoolErr failed")
}
_, err = PMapIntBoolErr(someLogicIntBoolErr, []int{3, 3, 10}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapIntBoolErr failed")
}
_, err = PMapIntBoolErr(someLogicIntBoolErr, []int{3, 10, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapIntBoolErr failed")
}
_, err = PMapIntBoolErr(someLogicIntBoolErr, []int{10, 10, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapIntBoolErr failed")
}
expectedList = []bool{true, true}
newList, _ = PMapIntBoolErr(someLogicIntBoolErr, []int{10, 10}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapIntBool failed")
}
_, err = PMapIntBoolErr(someLogicIntBoolErr, []int{10, 10, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntBoolErr failed")
}
_, err = PMapIntBoolErr(someLogicIntBoolErr, []int{10, 10, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntBoolErr failed")
}
_, err = PMapIntBoolErr(someLogicIntBoolErr, []int{3, 3, 10}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntBoolErr failed")
}
_, err = PMapIntBoolErr(someLogicIntBoolErr, []int{3, 10, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntBoolErr failed")
}
_, err = PMapIntBoolErr(someLogicIntBoolErr, []int{10, 10, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntBoolErr failed")
}
}
func TestPmapIntFloat32Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []float32{2, 3}
newList, _ := PMapIntFloat32Err(plusOneIntFloat32Err, []int{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapIntFloat32 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapIntFloat32Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapIntFloat32Err failed")
}
r, _ = PMapIntFloat32Err(nil, []int{})
if len(r) > 0 {
t.Errorf("PMapIntFloat32Err failed")
}
_, err := PMapIntFloat32Err(plusOneIntFloat32Err, []int{1, 2, 3})
if err == nil {
t.Errorf("PMapIntFloat32Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapIntFloat32Err(plusOneIntFloat32Err, []int{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapIntFloat32Err failed")
}
_, err = PMapIntFloat32Err(plusOneIntFloat32Err, []int{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapIntFloat32Err failed")
}
_, err = PMapIntFloat32Err(plusOneIntFloat32Err, []int{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapIntFloat32Err failed")
}
_, err = PMapIntFloat32Err(plusOneIntFloat32Err, []int{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapIntFloat32Err failed")
}
expectedList = []float32{2, 3}
newList, _ = PMapIntFloat32Err(plusOneIntFloat32Err, []int{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapIntFloat32 failed")
}
_, err = PMapIntFloat32Err(plusOneIntFloat32Err, []int{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntFloat32Err failed")
}
_, err = PMapIntFloat32Err(plusOneIntFloat32Err, []int{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntFloat32Err failed")
}
_, err = PMapIntFloat32Err(plusOneIntFloat32Err, []int{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntFloat32Err failed")
}
_, err = PMapIntFloat32Err(plusOneIntFloat32Err, []int{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntFloat32Err failed")
}
_, err = PMapIntFloat32Err(plusOneIntFloat32Err, []int{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntFloat32Err failed")
}
}
func TestPmapIntFloat64Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []float64{2, 3}
newList, _ := PMapIntFloat64Err(plusOneIntFloat64Err, []int{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapIntFloat64 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapIntFloat64Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapIntFloat64Err failed")
}
r, _ = PMapIntFloat64Err(nil, []int{})
if len(r) > 0 {
t.Errorf("PMapIntFloat64Err failed")
}
_, err := PMapIntFloat64Err(plusOneIntFloat64Err, []int{1, 2, 3})
if err == nil {
t.Errorf("PMapIntFloat64Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapIntFloat64Err(plusOneIntFloat64Err, []int{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapIntFloat64Err failed")
}
_, err = PMapIntFloat64Err(plusOneIntFloat64Err, []int{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapIntFloat64Err failed")
}
_, err = PMapIntFloat64Err(plusOneIntFloat64Err, []int{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapIntFloat64Err failed")
}
_, err = PMapIntFloat64Err(plusOneIntFloat64Err, []int{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapIntFloat64Err failed")
}
expectedList = []float64{2, 3}
newList, _ = PMapIntFloat64Err(plusOneIntFloat64Err, []int{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapIntFloat64 failed")
}
_, err = PMapIntFloat64Err(plusOneIntFloat64Err, []int{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntFloat64Err failed")
}
_, err = PMapIntFloat64Err(plusOneIntFloat64Err, []int{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntFloat64Err failed")
}
_, err = PMapIntFloat64Err(plusOneIntFloat64Err, []int{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntFloat64Err failed")
}
_, err = PMapIntFloat64Err(plusOneIntFloat64Err, []int{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntFloat64Err failed")
}
_, err = PMapIntFloat64Err(plusOneIntFloat64Err, []int{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapIntFloat64Err failed")
}
}
func TestPmapInt64IntErr(t *testing.T) {
// Test : add 1 to the list
expectedList := []int{2, 3}
newList, _ := PMapInt64IntErr(plusOneInt64IntErr, []int64{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapInt64Int failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapInt64IntErr(nil, nil)
if len(r) > 0 {
t.Errorf("PMapInt64IntErr failed")
}
r, _ = PMapInt64IntErr(nil, []int64{})
if len(r) > 0 {
t.Errorf("PMapInt64IntErr failed")
}
_, err := PMapInt64IntErr(plusOneInt64IntErr, []int64{1, 2, 3})
if err == nil {
t.Errorf("PMapInt64IntErr failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapInt64IntErr(plusOneInt64IntErr, []int64{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt64IntErr failed")
}
_, err = PMapInt64IntErr(plusOneInt64IntErr, []int64{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapInt64IntErr failed")
}
_, err = PMapInt64IntErr(plusOneInt64IntErr, []int64{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt64IntErr failed")
}
_, err = PMapInt64IntErr(plusOneInt64IntErr, []int64{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt64IntErr failed")
}
expectedList = []int{2, 3}
newList, _ = PMapInt64IntErr(plusOneInt64IntErr, []int64{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapInt64Int failed")
}
_, err = PMapInt64IntErr(plusOneInt64IntErr, []int64{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64IntErr failed")
}
_, err = PMapInt64IntErr(plusOneInt64IntErr, []int64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64IntErr failed")
}
_, err = PMapInt64IntErr(plusOneInt64IntErr, []int64{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64IntErr failed")
}
_, err = PMapInt64IntErr(plusOneInt64IntErr, []int64{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64IntErr failed")
}
_, err = PMapInt64IntErr(plusOneInt64IntErr, []int64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64IntErr failed")
}
}
func TestPmapInt64Int32Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []int32{2, 3}
newList, _ := PMapInt64Int32Err(plusOneInt64Int32Err, []int64{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapInt64Int32 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapInt64Int32Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapInt64Int32Err failed")
}
r, _ = PMapInt64Int32Err(nil, []int64{})
if len(r) > 0 {
t.Errorf("PMapInt64Int32Err failed")
}
_, err := PMapInt64Int32Err(plusOneInt64Int32Err, []int64{1, 2, 3})
if err == nil {
t.Errorf("PMapInt64Int32Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapInt64Int32Err(plusOneInt64Int32Err, []int64{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt64Int32Err failed")
}
_, err = PMapInt64Int32Err(plusOneInt64Int32Err, []int64{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapInt64Int32Err failed")
}
_, err = PMapInt64Int32Err(plusOneInt64Int32Err, []int64{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt64Int32Err failed")
}
_, err = PMapInt64Int32Err(plusOneInt64Int32Err, []int64{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt64Int32Err failed")
}
expectedList = []int32{2, 3}
newList, _ = PMapInt64Int32Err(plusOneInt64Int32Err, []int64{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapInt64Int32 failed")
}
_, err = PMapInt64Int32Err(plusOneInt64Int32Err, []int64{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64Int32Err failed")
}
_, err = PMapInt64Int32Err(plusOneInt64Int32Err, []int64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64Int32Err failed")
}
_, err = PMapInt64Int32Err(plusOneInt64Int32Err, []int64{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64Int32Err failed")
}
_, err = PMapInt64Int32Err(plusOneInt64Int32Err, []int64{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64Int32Err failed")
}
_, err = PMapInt64Int32Err(plusOneInt64Int32Err, []int64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64Int32Err failed")
}
}
func TestPmapInt64Int16Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []int16{2, 3}
newList, _ := PMapInt64Int16Err(plusOneInt64Int16Err, []int64{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapInt64Int16 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapInt64Int16Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapInt64Int16Err failed")
}
r, _ = PMapInt64Int16Err(nil, []int64{})
if len(r) > 0 {
t.Errorf("PMapInt64Int16Err failed")
}
_, err := PMapInt64Int16Err(plusOneInt64Int16Err, []int64{1, 2, 3})
if err == nil {
t.Errorf("PMapInt64Int16Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapInt64Int16Err(plusOneInt64Int16Err, []int64{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt64Int16Err failed")
}
_, err = PMapInt64Int16Err(plusOneInt64Int16Err, []int64{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapInt64Int16Err failed")
}
_, err = PMapInt64Int16Err(plusOneInt64Int16Err, []int64{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt64Int16Err failed")
}
_, err = PMapInt64Int16Err(plusOneInt64Int16Err, []int64{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt64Int16Err failed")
}
expectedList = []int16{2, 3}
newList, _ = PMapInt64Int16Err(plusOneInt64Int16Err, []int64{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapInt64Int16 failed")
}
_, err = PMapInt64Int16Err(plusOneInt64Int16Err, []int64{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64Int16Err failed")
}
_, err = PMapInt64Int16Err(plusOneInt64Int16Err, []int64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64Int16Err failed")
}
_, err = PMapInt64Int16Err(plusOneInt64Int16Err, []int64{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64Int16Err failed")
}
_, err = PMapInt64Int16Err(plusOneInt64Int16Err, []int64{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64Int16Err failed")
}
_, err = PMapInt64Int16Err(plusOneInt64Int16Err, []int64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64Int16Err failed")
}
}
func TestPmapInt64Int8Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []int8{2, 3}
newList, _ := PMapInt64Int8Err(plusOneInt64Int8Err, []int64{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapInt64Int8 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapInt64Int8Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapInt64Int8Err failed")
}
r, _ = PMapInt64Int8Err(nil, []int64{})
if len(r) > 0 {
t.Errorf("PMapInt64Int8Err failed")
}
_, err := PMapInt64Int8Err(plusOneInt64Int8Err, []int64{1, 2, 3})
if err == nil {
t.Errorf("PMapInt64Int8Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapInt64Int8Err(plusOneInt64Int8Err, []int64{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt64Int8Err failed")
}
_, err = PMapInt64Int8Err(plusOneInt64Int8Err, []int64{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapInt64Int8Err failed")
}
_, err = PMapInt64Int8Err(plusOneInt64Int8Err, []int64{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt64Int8Err failed")
}
_, err = PMapInt64Int8Err(plusOneInt64Int8Err, []int64{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt64Int8Err failed")
}
expectedList = []int8{2, 3}
newList, _ = PMapInt64Int8Err(plusOneInt64Int8Err, []int64{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapInt64Int8 failed")
}
_, err = PMapInt64Int8Err(plusOneInt64Int8Err, []int64{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64Int8Err failed")
}
_, err = PMapInt64Int8Err(plusOneInt64Int8Err, []int64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64Int8Err failed")
}
_, err = PMapInt64Int8Err(plusOneInt64Int8Err, []int64{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64Int8Err failed")
}
_, err = PMapInt64Int8Err(plusOneInt64Int8Err, []int64{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64Int8Err failed")
}
_, err = PMapInt64Int8Err(plusOneInt64Int8Err, []int64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64Int8Err failed")
}
}
func TestPmapInt64UintErr(t *testing.T) {
// Test : add 1 to the list
expectedList := []uint{2, 3}
newList, _ := PMapInt64UintErr(plusOneInt64UintErr, []int64{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapInt64Uint failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapInt64UintErr(nil, nil)
if len(r) > 0 {
t.Errorf("PMapInt64UintErr failed")
}
r, _ = PMapInt64UintErr(nil, []int64{})
if len(r) > 0 {
t.Errorf("PMapInt64UintErr failed")
}
_, err := PMapInt64UintErr(plusOneInt64UintErr, []int64{1, 2, 3})
if err == nil {
t.Errorf("PMapInt64UintErr failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapInt64UintErr(plusOneInt64UintErr, []int64{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt64UintErr failed")
}
_, err = PMapInt64UintErr(plusOneInt64UintErr, []int64{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapInt64UintErr failed")
}
_, err = PMapInt64UintErr(plusOneInt64UintErr, []int64{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt64UintErr failed")
}
_, err = PMapInt64UintErr(plusOneInt64UintErr, []int64{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt64UintErr failed")
}
expectedList = []uint{2, 3}
newList, _ = PMapInt64UintErr(plusOneInt64UintErr, []int64{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapInt64Uint failed")
}
_, err = PMapInt64UintErr(plusOneInt64UintErr, []int64{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64UintErr failed")
}
_, err = PMapInt64UintErr(plusOneInt64UintErr, []int64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64UintErr failed")
}
_, err = PMapInt64UintErr(plusOneInt64UintErr, []int64{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64UintErr failed")
}
_, err = PMapInt64UintErr(plusOneInt64UintErr, []int64{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64UintErr failed")
}
_, err = PMapInt64UintErr(plusOneInt64UintErr, []int64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64UintErr failed")
}
}
func TestPmapInt64Uint64Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []uint64{2, 3}
newList, _ := PMapInt64Uint64Err(plusOneInt64Uint64Err, []int64{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapInt64Uint64 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapInt64Uint64Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapInt64Uint64Err failed")
}
r, _ = PMapInt64Uint64Err(nil, []int64{})
if len(r) > 0 {
t.Errorf("PMapInt64Uint64Err failed")
}
_, err := PMapInt64Uint64Err(plusOneInt64Uint64Err, []int64{1, 2, 3})
if err == nil {
t.Errorf("PMapInt64Uint64Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapInt64Uint64Err(plusOneInt64Uint64Err, []int64{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt64Uint64Err failed")
}
_, err = PMapInt64Uint64Err(plusOneInt64Uint64Err, []int64{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapInt64Uint64Err failed")
}
_, err = PMapInt64Uint64Err(plusOneInt64Uint64Err, []int64{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt64Uint64Err failed")
}
_, err = PMapInt64Uint64Err(plusOneInt64Uint64Err, []int64{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt64Uint64Err failed")
}
expectedList = []uint64{2, 3}
newList, _ = PMapInt64Uint64Err(plusOneInt64Uint64Err, []int64{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapInt64Uint64 failed")
}
_, err = PMapInt64Uint64Err(plusOneInt64Uint64Err, []int64{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64Uint64Err failed")
}
_, err = PMapInt64Uint64Err(plusOneInt64Uint64Err, []int64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64Uint64Err failed")
}
_, err = PMapInt64Uint64Err(plusOneInt64Uint64Err, []int64{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64Uint64Err failed")
}
_, err = PMapInt64Uint64Err(plusOneInt64Uint64Err, []int64{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64Uint64Err failed")
}
_, err = PMapInt64Uint64Err(plusOneInt64Uint64Err, []int64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64Uint64Err failed")
}
}
func TestPmapInt64Uint32Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []uint32{2, 3}
newList, _ := PMapInt64Uint32Err(plusOneInt64Uint32Err, []int64{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapInt64Uint32 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapInt64Uint32Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapInt64Uint32Err failed")
}
r, _ = PMapInt64Uint32Err(nil, []int64{})
if len(r) > 0 {
t.Errorf("PMapInt64Uint32Err failed")
}
_, err := PMapInt64Uint32Err(plusOneInt64Uint32Err, []int64{1, 2, 3})
if err == nil {
t.Errorf("PMapInt64Uint32Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapInt64Uint32Err(plusOneInt64Uint32Err, []int64{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt64Uint32Err failed")
}
_, err = PMapInt64Uint32Err(plusOneInt64Uint32Err, []int64{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapInt64Uint32Err failed")
}
_, err = PMapInt64Uint32Err(plusOneInt64Uint32Err, []int64{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt64Uint32Err failed")
}
_, err = PMapInt64Uint32Err(plusOneInt64Uint32Err, []int64{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt64Uint32Err failed")
}
expectedList = []uint32{2, 3}
newList, _ = PMapInt64Uint32Err(plusOneInt64Uint32Err, []int64{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapInt64Uint32 failed")
}
_, err = PMapInt64Uint32Err(plusOneInt64Uint32Err, []int64{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64Uint32Err failed")
}
_, err = PMapInt64Uint32Err(plusOneInt64Uint32Err, []int64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64Uint32Err failed")
}
_, err = PMapInt64Uint32Err(plusOneInt64Uint32Err, []int64{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64Uint32Err failed")
}
_, err = PMapInt64Uint32Err(plusOneInt64Uint32Err, []int64{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64Uint32Err failed")
}
_, err = PMapInt64Uint32Err(plusOneInt64Uint32Err, []int64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64Uint32Err failed")
}
}
func TestPmapInt64Uint16Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []uint16{2, 3}
newList, _ := PMapInt64Uint16Err(plusOneInt64Uint16Err, []int64{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapInt64Uint16 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapInt64Uint16Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapInt64Uint16Err failed")
}
r, _ = PMapInt64Uint16Err(nil, []int64{})
if len(r) > 0 {
t.Errorf("PMapInt64Uint16Err failed")
}
_, err := PMapInt64Uint16Err(plusOneInt64Uint16Err, []int64{1, 2, 3})
if err == nil {
t.Errorf("PMapInt64Uint16Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapInt64Uint16Err(plusOneInt64Uint16Err, []int64{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt64Uint16Err failed")
}
_, err = PMapInt64Uint16Err(plusOneInt64Uint16Err, []int64{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapInt64Uint16Err failed")
}
_, err = PMapInt64Uint16Err(plusOneInt64Uint16Err, []int64{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt64Uint16Err failed")
}
_, err = PMapInt64Uint16Err(plusOneInt64Uint16Err, []int64{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt64Uint16Err failed")
}
expectedList = []uint16{2, 3}
newList, _ = PMapInt64Uint16Err(plusOneInt64Uint16Err, []int64{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapInt64Uint16 failed")
}
_, err = PMapInt64Uint16Err(plusOneInt64Uint16Err, []int64{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64Uint16Err failed")
}
_, err = PMapInt64Uint16Err(plusOneInt64Uint16Err, []int64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64Uint16Err failed")
}
_, err = PMapInt64Uint16Err(plusOneInt64Uint16Err, []int64{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64Uint16Err failed")
}
_, err = PMapInt64Uint16Err(plusOneInt64Uint16Err, []int64{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64Uint16Err failed")
}
_, err = PMapInt64Uint16Err(plusOneInt64Uint16Err, []int64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64Uint16Err failed")
}
}
func TestPmapInt64Uint8Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []uint8{2, 3}
newList, _ := PMapInt64Uint8Err(plusOneInt64Uint8Err, []int64{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapInt64Uint8 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapInt64Uint8Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapInt64Uint8Err failed")
}
r, _ = PMapInt64Uint8Err(nil, []int64{})
if len(r) > 0 {
t.Errorf("PMapInt64Uint8Err failed")
}
_, err := PMapInt64Uint8Err(plusOneInt64Uint8Err, []int64{1, 2, 3})
if err == nil {
t.Errorf("PMapInt64Uint8Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapInt64Uint8Err(plusOneInt64Uint8Err, []int64{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt64Uint8Err failed")
}
_, err = PMapInt64Uint8Err(plusOneInt64Uint8Err, []int64{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapInt64Uint8Err failed")
}
_, err = PMapInt64Uint8Err(plusOneInt64Uint8Err, []int64{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt64Uint8Err failed")
}
_, err = PMapInt64Uint8Err(plusOneInt64Uint8Err, []int64{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt64Uint8Err failed")
}
expectedList = []uint8{2, 3}
newList, _ = PMapInt64Uint8Err(plusOneInt64Uint8Err, []int64{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapInt64Uint8 failed")
}
_, err = PMapInt64Uint8Err(plusOneInt64Uint8Err, []int64{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64Uint8Err failed")
}
_, err = PMapInt64Uint8Err(plusOneInt64Uint8Err, []int64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64Uint8Err failed")
}
_, err = PMapInt64Uint8Err(plusOneInt64Uint8Err, []int64{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64Uint8Err failed")
}
_, err = PMapInt64Uint8Err(plusOneInt64Uint8Err, []int64{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64Uint8Err failed")
}
_, err = PMapInt64Uint8Err(plusOneInt64Uint8Err, []int64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64Uint8Err failed")
}
}
func TestPmapInt64StrErr(t *testing.T) {
// Test : someLogic
expectedList := []string{"10"}
newList, _ := PMapInt64StrErr(someLogicInt64StrErr, []int64{10})
if newList[0] != expectedList[0] {
t.Errorf("PMapInt64StrErr failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapInt64StrErr(nil, nil)
if len(r) > 0 {
t.Errorf("PMapInt64StrErr failed")
}
r, _ = PMapInt64StrErr(nil, []int64{})
if len(r) > 0 {
t.Errorf("PMapInt64StrErr failed")
}
_, err := PMapInt64StrErr(someLogicInt64StrErr, []int64{10, 0})
if err == nil {
t.Errorf("PMapInt64StrErr failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapInt64StrErr(someLogicInt64StrErr, []int64{10, 10, 0}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt64StrErr failed")
}
_, err = PMapInt64StrErr(someLogicInt64StrErr, []int64{0, 0, 10}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapInt64StrErr failed")
}
_, err = PMapInt64StrErr(someLogicInt64StrErr, []int64{0, 10, 0}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt64StrErr failed")
}
_, err = PMapInt64StrErr(someLogicInt64StrErr, []int64{10, 10, 0}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt64StrErr failed")
}
expectedList = []string{"10", "10"}
newList, _ = PMapInt64StrErr(someLogicInt64StrErr, []int64{10, 10}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapInt64Str failed")
}
_, err = PMapInt64StrErr(someLogicInt64StrErr, []int64{10, 10, 0}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64StrErr failed")
}
_, err = PMapInt64StrErr(someLogicInt64StrErr, []int64{10, 10, 0}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64StrErr failed")
}
_, err = PMapInt64StrErr(someLogicInt64StrErr, []int64{0, 0, 10}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64StrErr failed")
}
_, err = PMapInt64StrErr(someLogicInt64StrErr, []int64{0, 10, 0}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64StrErr failed")
}
_, err = PMapInt64StrErr(someLogicInt64StrErr, []int64{10, 10, 0}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64StrErr failed")
}
}
func TestPmapInt64BoolErr(t *testing.T) {
// Test : someLogic
expectedList := []bool{true, false}
newList, _ := PMapInt64BoolErr(someLogicInt64BoolErr, []int64{10, 0})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapInt64BoolErr failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapInt64BoolErr(nil, nil)
if len(r) > 0 {
t.Errorf("PMapInt64BoolErr failed")
}
r, _ = PMapInt64BoolErr(nil, []int64{})
if len(r) > 0 {
t.Errorf("PMapInt64BoolErr failed")
}
_, err := PMapInt64BoolErr(someLogicInt64BoolErr, []int64{10, 3, 3})
if err == nil {
t.Errorf("PMapInt64BoolErr failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapInt64BoolErr(someLogicInt64BoolErr, []int64{10, 10, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt64BoolErr failed")
}
_, err = PMapInt64BoolErr(someLogicInt64BoolErr, []int64{3, 3, 10}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapInt64BoolErr failed")
}
_, err = PMapInt64BoolErr(someLogicInt64BoolErr, []int64{3, 10, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt64BoolErr failed")
}
_, err = PMapInt64BoolErr(someLogicInt64BoolErr, []int64{10, 10, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt64BoolErr failed")
}
expectedList = []bool{true, true}
newList, _ = PMapInt64BoolErr(someLogicInt64BoolErr, []int64{10, 10}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapInt64Bool failed")
}
_, err = PMapInt64BoolErr(someLogicInt64BoolErr, []int64{10, 10, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64BoolErr failed")
}
_, err = PMapInt64BoolErr(someLogicInt64BoolErr, []int64{10, 10, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64BoolErr failed")
}
_, err = PMapInt64BoolErr(someLogicInt64BoolErr, []int64{3, 3, 10}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64BoolErr failed")
}
_, err = PMapInt64BoolErr(someLogicInt64BoolErr, []int64{3, 10, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64BoolErr failed")
}
_, err = PMapInt64BoolErr(someLogicInt64BoolErr, []int64{10, 10, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64BoolErr failed")
}
}
func TestPmapInt64Float32Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []float32{2, 3}
newList, _ := PMapInt64Float32Err(plusOneInt64Float32Err, []int64{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapInt64Float32 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapInt64Float32Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapInt64Float32Err failed")
}
r, _ = PMapInt64Float32Err(nil, []int64{})
if len(r) > 0 {
t.Errorf("PMapInt64Float32Err failed")
}
_, err := PMapInt64Float32Err(plusOneInt64Float32Err, []int64{1, 2, 3})
if err == nil {
t.Errorf("PMapInt64Float32Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapInt64Float32Err(plusOneInt64Float32Err, []int64{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt64Float32Err failed")
}
_, err = PMapInt64Float32Err(plusOneInt64Float32Err, []int64{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapInt64Float32Err failed")
}
_, err = PMapInt64Float32Err(plusOneInt64Float32Err, []int64{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt64Float32Err failed")
}
_, err = PMapInt64Float32Err(plusOneInt64Float32Err, []int64{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt64Float32Err failed")
}
expectedList = []float32{2, 3}
newList, _ = PMapInt64Float32Err(plusOneInt64Float32Err, []int64{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapInt64Float32 failed")
}
_, err = PMapInt64Float32Err(plusOneInt64Float32Err, []int64{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64Float32Err failed")
}
_, err = PMapInt64Float32Err(plusOneInt64Float32Err, []int64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64Float32Err failed")
}
_, err = PMapInt64Float32Err(plusOneInt64Float32Err, []int64{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64Float32Err failed")
}
_, err = PMapInt64Float32Err(plusOneInt64Float32Err, []int64{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64Float32Err failed")
}
_, err = PMapInt64Float32Err(plusOneInt64Float32Err, []int64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64Float32Err failed")
}
}
func TestPmapInt64Float64Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []float64{2, 3}
newList, _ := PMapInt64Float64Err(plusOneInt64Float64Err, []int64{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapInt64Float64 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapInt64Float64Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapInt64Float64Err failed")
}
r, _ = PMapInt64Float64Err(nil, []int64{})
if len(r) > 0 {
t.Errorf("PMapInt64Float64Err failed")
}
_, err := PMapInt64Float64Err(plusOneInt64Float64Err, []int64{1, 2, 3})
if err == nil {
t.Errorf("PMapInt64Float64Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapInt64Float64Err(plusOneInt64Float64Err, []int64{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt64Float64Err failed")
}
_, err = PMapInt64Float64Err(plusOneInt64Float64Err, []int64{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapInt64Float64Err failed")
}
_, err = PMapInt64Float64Err(plusOneInt64Float64Err, []int64{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt64Float64Err failed")
}
_, err = PMapInt64Float64Err(plusOneInt64Float64Err, []int64{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt64Float64Err failed")
}
expectedList = []float64{2, 3}
newList, _ = PMapInt64Float64Err(plusOneInt64Float64Err, []int64{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapInt64Float64 failed")
}
_, err = PMapInt64Float64Err(plusOneInt64Float64Err, []int64{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64Float64Err failed")
}
_, err = PMapInt64Float64Err(plusOneInt64Float64Err, []int64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64Float64Err failed")
}
_, err = PMapInt64Float64Err(plusOneInt64Float64Err, []int64{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64Float64Err failed")
}
_, err = PMapInt64Float64Err(plusOneInt64Float64Err, []int64{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64Float64Err failed")
}
_, err = PMapInt64Float64Err(plusOneInt64Float64Err, []int64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt64Float64Err failed")
}
}
func TestPmapInt32IntErr(t *testing.T) {
// Test : add 1 to the list
expectedList := []int{2, 3}
newList, _ := PMapInt32IntErr(plusOneInt32IntErr, []int32{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapInt32Int failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapInt32IntErr(nil, nil)
if len(r) > 0 {
t.Errorf("PMapInt32IntErr failed")
}
r, _ = PMapInt32IntErr(nil, []int32{})
if len(r) > 0 {
t.Errorf("PMapInt32IntErr failed")
}
_, err := PMapInt32IntErr(plusOneInt32IntErr, []int32{1, 2, 3})
if err == nil {
t.Errorf("PMapInt32IntErr failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapInt32IntErr(plusOneInt32IntErr, []int32{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt32IntErr failed")
}
_, err = PMapInt32IntErr(plusOneInt32IntErr, []int32{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapInt32IntErr failed")
}
_, err = PMapInt32IntErr(plusOneInt32IntErr, []int32{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt32IntErr failed")
}
_, err = PMapInt32IntErr(plusOneInt32IntErr, []int32{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt32IntErr failed")
}
expectedList = []int{2, 3}
newList, _ = PMapInt32IntErr(plusOneInt32IntErr, []int32{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapInt32Int failed")
}
_, err = PMapInt32IntErr(plusOneInt32IntErr, []int32{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32IntErr failed")
}
_, err = PMapInt32IntErr(plusOneInt32IntErr, []int32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32IntErr failed")
}
_, err = PMapInt32IntErr(plusOneInt32IntErr, []int32{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32IntErr failed")
}
_, err = PMapInt32IntErr(plusOneInt32IntErr, []int32{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32IntErr failed")
}
_, err = PMapInt32IntErr(plusOneInt32IntErr, []int32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32IntErr failed")
}
}
func TestPmapInt32Int64Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []int64{2, 3}
newList, _ := PMapInt32Int64Err(plusOneInt32Int64Err, []int32{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapInt32Int64 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapInt32Int64Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapInt32Int64Err failed")
}
r, _ = PMapInt32Int64Err(nil, []int32{})
if len(r) > 0 {
t.Errorf("PMapInt32Int64Err failed")
}
_, err := PMapInt32Int64Err(plusOneInt32Int64Err, []int32{1, 2, 3})
if err == nil {
t.Errorf("PMapInt32Int64Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapInt32Int64Err(plusOneInt32Int64Err, []int32{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt32Int64Err failed")
}
_, err = PMapInt32Int64Err(plusOneInt32Int64Err, []int32{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapInt32Int64Err failed")
}
_, err = PMapInt32Int64Err(plusOneInt32Int64Err, []int32{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt32Int64Err failed")
}
_, err = PMapInt32Int64Err(plusOneInt32Int64Err, []int32{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt32Int64Err failed")
}
expectedList = []int64{2, 3}
newList, _ = PMapInt32Int64Err(plusOneInt32Int64Err, []int32{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapInt32Int64 failed")
}
_, err = PMapInt32Int64Err(plusOneInt32Int64Err, []int32{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32Int64Err failed")
}
_, err = PMapInt32Int64Err(plusOneInt32Int64Err, []int32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32Int64Err failed")
}
_, err = PMapInt32Int64Err(plusOneInt32Int64Err, []int32{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32Int64Err failed")
}
_, err = PMapInt32Int64Err(plusOneInt32Int64Err, []int32{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32Int64Err failed")
}
_, err = PMapInt32Int64Err(plusOneInt32Int64Err, []int32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32Int64Err failed")
}
}
func TestPmapInt32Int16Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []int16{2, 3}
newList, _ := PMapInt32Int16Err(plusOneInt32Int16Err, []int32{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapInt32Int16 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapInt32Int16Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapInt32Int16Err failed")
}
r, _ = PMapInt32Int16Err(nil, []int32{})
if len(r) > 0 {
t.Errorf("PMapInt32Int16Err failed")
}
_, err := PMapInt32Int16Err(plusOneInt32Int16Err, []int32{1, 2, 3})
if err == nil {
t.Errorf("PMapInt32Int16Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapInt32Int16Err(plusOneInt32Int16Err, []int32{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt32Int16Err failed")
}
_, err = PMapInt32Int16Err(plusOneInt32Int16Err, []int32{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapInt32Int16Err failed")
}
_, err = PMapInt32Int16Err(plusOneInt32Int16Err, []int32{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt32Int16Err failed")
}
_, err = PMapInt32Int16Err(plusOneInt32Int16Err, []int32{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt32Int16Err failed")
}
expectedList = []int16{2, 3}
newList, _ = PMapInt32Int16Err(plusOneInt32Int16Err, []int32{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapInt32Int16 failed")
}
_, err = PMapInt32Int16Err(plusOneInt32Int16Err, []int32{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32Int16Err failed")
}
_, err = PMapInt32Int16Err(plusOneInt32Int16Err, []int32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32Int16Err failed")
}
_, err = PMapInt32Int16Err(plusOneInt32Int16Err, []int32{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32Int16Err failed")
}
_, err = PMapInt32Int16Err(plusOneInt32Int16Err, []int32{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32Int16Err failed")
}
_, err = PMapInt32Int16Err(plusOneInt32Int16Err, []int32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32Int16Err failed")
}
}
func TestPmapInt32Int8Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []int8{2, 3}
newList, _ := PMapInt32Int8Err(plusOneInt32Int8Err, []int32{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapInt32Int8 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapInt32Int8Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapInt32Int8Err failed")
}
r, _ = PMapInt32Int8Err(nil, []int32{})
if len(r) > 0 {
t.Errorf("PMapInt32Int8Err failed")
}
_, err := PMapInt32Int8Err(plusOneInt32Int8Err, []int32{1, 2, 3})
if err == nil {
t.Errorf("PMapInt32Int8Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapInt32Int8Err(plusOneInt32Int8Err, []int32{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt32Int8Err failed")
}
_, err = PMapInt32Int8Err(plusOneInt32Int8Err, []int32{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapInt32Int8Err failed")
}
_, err = PMapInt32Int8Err(plusOneInt32Int8Err, []int32{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt32Int8Err failed")
}
_, err = PMapInt32Int8Err(plusOneInt32Int8Err, []int32{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt32Int8Err failed")
}
expectedList = []int8{2, 3}
newList, _ = PMapInt32Int8Err(plusOneInt32Int8Err, []int32{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapInt32Int8 failed")
}
_, err = PMapInt32Int8Err(plusOneInt32Int8Err, []int32{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32Int8Err failed")
}
_, err = PMapInt32Int8Err(plusOneInt32Int8Err, []int32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32Int8Err failed")
}
_, err = PMapInt32Int8Err(plusOneInt32Int8Err, []int32{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32Int8Err failed")
}
_, err = PMapInt32Int8Err(plusOneInt32Int8Err, []int32{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32Int8Err failed")
}
_, err = PMapInt32Int8Err(plusOneInt32Int8Err, []int32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32Int8Err failed")
}
}
func TestPmapInt32UintErr(t *testing.T) {
// Test : add 1 to the list
expectedList := []uint{2, 3}
newList, _ := PMapInt32UintErr(plusOneInt32UintErr, []int32{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapInt32Uint failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapInt32UintErr(nil, nil)
if len(r) > 0 {
t.Errorf("PMapInt32UintErr failed")
}
r, _ = PMapInt32UintErr(nil, []int32{})
if len(r) > 0 {
t.Errorf("PMapInt32UintErr failed")
}
_, err := PMapInt32UintErr(plusOneInt32UintErr, []int32{1, 2, 3})
if err == nil {
t.Errorf("PMapInt32UintErr failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapInt32UintErr(plusOneInt32UintErr, []int32{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt32UintErr failed")
}
_, err = PMapInt32UintErr(plusOneInt32UintErr, []int32{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapInt32UintErr failed")
}
_, err = PMapInt32UintErr(plusOneInt32UintErr, []int32{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt32UintErr failed")
}
_, err = PMapInt32UintErr(plusOneInt32UintErr, []int32{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt32UintErr failed")
}
expectedList = []uint{2, 3}
newList, _ = PMapInt32UintErr(plusOneInt32UintErr, []int32{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapInt32Uint failed")
}
_, err = PMapInt32UintErr(plusOneInt32UintErr, []int32{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32UintErr failed")
}
_, err = PMapInt32UintErr(plusOneInt32UintErr, []int32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32UintErr failed")
}
_, err = PMapInt32UintErr(plusOneInt32UintErr, []int32{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32UintErr failed")
}
_, err = PMapInt32UintErr(plusOneInt32UintErr, []int32{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32UintErr failed")
}
_, err = PMapInt32UintErr(plusOneInt32UintErr, []int32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32UintErr failed")
}
}
func TestPmapInt32Uint64Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []uint64{2, 3}
newList, _ := PMapInt32Uint64Err(plusOneInt32Uint64Err, []int32{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapInt32Uint64 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapInt32Uint64Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapInt32Uint64Err failed")
}
r, _ = PMapInt32Uint64Err(nil, []int32{})
if len(r) > 0 {
t.Errorf("PMapInt32Uint64Err failed")
}
_, err := PMapInt32Uint64Err(plusOneInt32Uint64Err, []int32{1, 2, 3})
if err == nil {
t.Errorf("PMapInt32Uint64Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapInt32Uint64Err(plusOneInt32Uint64Err, []int32{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt32Uint64Err failed")
}
_, err = PMapInt32Uint64Err(plusOneInt32Uint64Err, []int32{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapInt32Uint64Err failed")
}
_, err = PMapInt32Uint64Err(plusOneInt32Uint64Err, []int32{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt32Uint64Err failed")
}
_, err = PMapInt32Uint64Err(plusOneInt32Uint64Err, []int32{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt32Uint64Err failed")
}
expectedList = []uint64{2, 3}
newList, _ = PMapInt32Uint64Err(plusOneInt32Uint64Err, []int32{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapInt32Uint64 failed")
}
_, err = PMapInt32Uint64Err(plusOneInt32Uint64Err, []int32{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32Uint64Err failed")
}
_, err = PMapInt32Uint64Err(plusOneInt32Uint64Err, []int32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32Uint64Err failed")
}
_, err = PMapInt32Uint64Err(plusOneInt32Uint64Err, []int32{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32Uint64Err failed")
}
_, err = PMapInt32Uint64Err(plusOneInt32Uint64Err, []int32{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32Uint64Err failed")
}
_, err = PMapInt32Uint64Err(plusOneInt32Uint64Err, []int32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32Uint64Err failed")
}
}
func TestPmapInt32Uint32Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []uint32{2, 3}
newList, _ := PMapInt32Uint32Err(plusOneInt32Uint32Err, []int32{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapInt32Uint32 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapInt32Uint32Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapInt32Uint32Err failed")
}
r, _ = PMapInt32Uint32Err(nil, []int32{})
if len(r) > 0 {
t.Errorf("PMapInt32Uint32Err failed")
}
_, err := PMapInt32Uint32Err(plusOneInt32Uint32Err, []int32{1, 2, 3})
if err == nil {
t.Errorf("PMapInt32Uint32Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapInt32Uint32Err(plusOneInt32Uint32Err, []int32{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt32Uint32Err failed")
}
_, err = PMapInt32Uint32Err(plusOneInt32Uint32Err, []int32{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapInt32Uint32Err failed")
}
_, err = PMapInt32Uint32Err(plusOneInt32Uint32Err, []int32{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt32Uint32Err failed")
}
_, err = PMapInt32Uint32Err(plusOneInt32Uint32Err, []int32{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt32Uint32Err failed")
}
expectedList = []uint32{2, 3}
newList, _ = PMapInt32Uint32Err(plusOneInt32Uint32Err, []int32{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapInt32Uint32 failed")
}
_, err = PMapInt32Uint32Err(plusOneInt32Uint32Err, []int32{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32Uint32Err failed")
}
_, err = PMapInt32Uint32Err(plusOneInt32Uint32Err, []int32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32Uint32Err failed")
}
_, err = PMapInt32Uint32Err(plusOneInt32Uint32Err, []int32{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32Uint32Err failed")
}
_, err = PMapInt32Uint32Err(plusOneInt32Uint32Err, []int32{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32Uint32Err failed")
}
_, err = PMapInt32Uint32Err(plusOneInt32Uint32Err, []int32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32Uint32Err failed")
}
}
func TestPmapInt32Uint16Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []uint16{2, 3}
newList, _ := PMapInt32Uint16Err(plusOneInt32Uint16Err, []int32{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapInt32Uint16 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapInt32Uint16Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapInt32Uint16Err failed")
}
r, _ = PMapInt32Uint16Err(nil, []int32{})
if len(r) > 0 {
t.Errorf("PMapInt32Uint16Err failed")
}
_, err := PMapInt32Uint16Err(plusOneInt32Uint16Err, []int32{1, 2, 3})
if err == nil {
t.Errorf("PMapInt32Uint16Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapInt32Uint16Err(plusOneInt32Uint16Err, []int32{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt32Uint16Err failed")
}
_, err = PMapInt32Uint16Err(plusOneInt32Uint16Err, []int32{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapInt32Uint16Err failed")
}
_, err = PMapInt32Uint16Err(plusOneInt32Uint16Err, []int32{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt32Uint16Err failed")
}
_, err = PMapInt32Uint16Err(plusOneInt32Uint16Err, []int32{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt32Uint16Err failed")
}
expectedList = []uint16{2, 3}
newList, _ = PMapInt32Uint16Err(plusOneInt32Uint16Err, []int32{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapInt32Uint16 failed")
}
_, err = PMapInt32Uint16Err(plusOneInt32Uint16Err, []int32{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32Uint16Err failed")
}
_, err = PMapInt32Uint16Err(plusOneInt32Uint16Err, []int32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32Uint16Err failed")
}
_, err = PMapInt32Uint16Err(plusOneInt32Uint16Err, []int32{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32Uint16Err failed")
}
_, err = PMapInt32Uint16Err(plusOneInt32Uint16Err, []int32{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32Uint16Err failed")
}
_, err = PMapInt32Uint16Err(plusOneInt32Uint16Err, []int32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32Uint16Err failed")
}
}
func TestPmapInt32Uint8Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []uint8{2, 3}
newList, _ := PMapInt32Uint8Err(plusOneInt32Uint8Err, []int32{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapInt32Uint8 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapInt32Uint8Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapInt32Uint8Err failed")
}
r, _ = PMapInt32Uint8Err(nil, []int32{})
if len(r) > 0 {
t.Errorf("PMapInt32Uint8Err failed")
}
_, err := PMapInt32Uint8Err(plusOneInt32Uint8Err, []int32{1, 2, 3})
if err == nil {
t.Errorf("PMapInt32Uint8Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapInt32Uint8Err(plusOneInt32Uint8Err, []int32{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt32Uint8Err failed")
}
_, err = PMapInt32Uint8Err(plusOneInt32Uint8Err, []int32{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapInt32Uint8Err failed")
}
_, err = PMapInt32Uint8Err(plusOneInt32Uint8Err, []int32{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt32Uint8Err failed")
}
_, err = PMapInt32Uint8Err(plusOneInt32Uint8Err, []int32{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt32Uint8Err failed")
}
expectedList = []uint8{2, 3}
newList, _ = PMapInt32Uint8Err(plusOneInt32Uint8Err, []int32{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapInt32Uint8 failed")
}
_, err = PMapInt32Uint8Err(plusOneInt32Uint8Err, []int32{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32Uint8Err failed")
}
_, err = PMapInt32Uint8Err(plusOneInt32Uint8Err, []int32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32Uint8Err failed")
}
_, err = PMapInt32Uint8Err(plusOneInt32Uint8Err, []int32{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32Uint8Err failed")
}
_, err = PMapInt32Uint8Err(plusOneInt32Uint8Err, []int32{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32Uint8Err failed")
}
_, err = PMapInt32Uint8Err(plusOneInt32Uint8Err, []int32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32Uint8Err failed")
}
}
func TestPmapInt32StrErr(t *testing.T) {
// Test : someLogic
expectedList := []string{"10"}
newList, _ := PMapInt32StrErr(someLogicInt32StrErr, []int32{10})
if newList[0] != expectedList[0] {
t.Errorf("PMapInt32StrErr failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapInt32StrErr(nil, nil)
if len(r) > 0 {
t.Errorf("PMapInt32StrErr failed")
}
r, _ = PMapInt32StrErr(nil, []int32{})
if len(r) > 0 {
t.Errorf("PMapInt32StrErr failed")
}
_, err := PMapInt32StrErr(someLogicInt32StrErr, []int32{10, 0})
if err == nil {
t.Errorf("PMapInt32StrErr failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapInt32StrErr(someLogicInt32StrErr, []int32{10, 10, 0}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt32StrErr failed")
}
_, err = PMapInt32StrErr(someLogicInt32StrErr, []int32{0, 0, 10}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapInt32StrErr failed")
}
_, err = PMapInt32StrErr(someLogicInt32StrErr, []int32{0, 10, 0}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt32StrErr failed")
}
_, err = PMapInt32StrErr(someLogicInt32StrErr, []int32{10, 10, 0}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt32StrErr failed")
}
expectedList = []string{"10", "10"}
newList, _ = PMapInt32StrErr(someLogicInt32StrErr, []int32{10, 10}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapInt32Str failed")
}
_, err = PMapInt32StrErr(someLogicInt32StrErr, []int32{10, 10, 0}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32StrErr failed")
}
_, err = PMapInt32StrErr(someLogicInt32StrErr, []int32{10, 10, 0}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32StrErr failed")
}
_, err = PMapInt32StrErr(someLogicInt32StrErr, []int32{0, 0, 10}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32StrErr failed")
}
_, err = PMapInt32StrErr(someLogicInt32StrErr, []int32{0, 10, 0}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32StrErr failed")
}
_, err = PMapInt32StrErr(someLogicInt32StrErr, []int32{10, 10, 0}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32StrErr failed")
}
}
func TestPmapInt32BoolErr(t *testing.T) {
// Test : someLogic
expectedList := []bool{true, false}
newList, _ := PMapInt32BoolErr(someLogicInt32BoolErr, []int32{10, 0})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapInt32BoolErr failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapInt32BoolErr(nil, nil)
if len(r) > 0 {
t.Errorf("PMapInt32BoolErr failed")
}
r, _ = PMapInt32BoolErr(nil, []int32{})
if len(r) > 0 {
t.Errorf("PMapInt32BoolErr failed")
}
_, err := PMapInt32BoolErr(someLogicInt32BoolErr, []int32{10, 3, 3})
if err == nil {
t.Errorf("PMapInt32BoolErr failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapInt32BoolErr(someLogicInt32BoolErr, []int32{10, 10, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt32BoolErr failed")
}
_, err = PMapInt32BoolErr(someLogicInt32BoolErr, []int32{3, 3, 10}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapInt32BoolErr failed")
}
_, err = PMapInt32BoolErr(someLogicInt32BoolErr, []int32{3, 10, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt32BoolErr failed")
}
_, err = PMapInt32BoolErr(someLogicInt32BoolErr, []int32{10, 10, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt32BoolErr failed")
}
expectedList = []bool{true, true}
newList, _ = PMapInt32BoolErr(someLogicInt32BoolErr, []int32{10, 10}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapInt32Bool failed")
}
_, err = PMapInt32BoolErr(someLogicInt32BoolErr, []int32{10, 10, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32BoolErr failed")
}
_, err = PMapInt32BoolErr(someLogicInt32BoolErr, []int32{10, 10, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32BoolErr failed")
}
_, err = PMapInt32BoolErr(someLogicInt32BoolErr, []int32{3, 3, 10}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32BoolErr failed")
}
_, err = PMapInt32BoolErr(someLogicInt32BoolErr, []int32{3, 10, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32BoolErr failed")
}
_, err = PMapInt32BoolErr(someLogicInt32BoolErr, []int32{10, 10, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32BoolErr failed")
}
}
func TestPmapInt32Float32Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []float32{2, 3}
newList, _ := PMapInt32Float32Err(plusOneInt32Float32Err, []int32{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapInt32Float32 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapInt32Float32Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapInt32Float32Err failed")
}
r, _ = PMapInt32Float32Err(nil, []int32{})
if len(r) > 0 {
t.Errorf("PMapInt32Float32Err failed")
}
_, err := PMapInt32Float32Err(plusOneInt32Float32Err, []int32{1, 2, 3})
if err == nil {
t.Errorf("PMapInt32Float32Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapInt32Float32Err(plusOneInt32Float32Err, []int32{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt32Float32Err failed")
}
_, err = PMapInt32Float32Err(plusOneInt32Float32Err, []int32{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapInt32Float32Err failed")
}
_, err = PMapInt32Float32Err(plusOneInt32Float32Err, []int32{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt32Float32Err failed")
}
_, err = PMapInt32Float32Err(plusOneInt32Float32Err, []int32{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt32Float32Err failed")
}
expectedList = []float32{2, 3}
newList, _ = PMapInt32Float32Err(plusOneInt32Float32Err, []int32{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapInt32Float32 failed")
}
_, err = PMapInt32Float32Err(plusOneInt32Float32Err, []int32{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32Float32Err failed")
}
_, err = PMapInt32Float32Err(plusOneInt32Float32Err, []int32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32Float32Err failed")
}
_, err = PMapInt32Float32Err(plusOneInt32Float32Err, []int32{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32Float32Err failed")
}
_, err = PMapInt32Float32Err(plusOneInt32Float32Err, []int32{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32Float32Err failed")
}
_, err = PMapInt32Float32Err(plusOneInt32Float32Err, []int32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32Float32Err failed")
}
}
func TestPmapInt32Float64Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []float64{2, 3}
newList, _ := PMapInt32Float64Err(plusOneInt32Float64Err, []int32{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapInt32Float64 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapInt32Float64Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapInt32Float64Err failed")
}
r, _ = PMapInt32Float64Err(nil, []int32{})
if len(r) > 0 {
t.Errorf("PMapInt32Float64Err failed")
}
_, err := PMapInt32Float64Err(plusOneInt32Float64Err, []int32{1, 2, 3})
if err == nil {
t.Errorf("PMapInt32Float64Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapInt32Float64Err(plusOneInt32Float64Err, []int32{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt32Float64Err failed")
}
_, err = PMapInt32Float64Err(plusOneInt32Float64Err, []int32{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapInt32Float64Err failed")
}
_, err = PMapInt32Float64Err(plusOneInt32Float64Err, []int32{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt32Float64Err failed")
}
_, err = PMapInt32Float64Err(plusOneInt32Float64Err, []int32{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt32Float64Err failed")
}
expectedList = []float64{2, 3}
newList, _ = PMapInt32Float64Err(plusOneInt32Float64Err, []int32{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapInt32Float64 failed")
}
_, err = PMapInt32Float64Err(plusOneInt32Float64Err, []int32{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32Float64Err failed")
}
_, err = PMapInt32Float64Err(plusOneInt32Float64Err, []int32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32Float64Err failed")
}
_, err = PMapInt32Float64Err(plusOneInt32Float64Err, []int32{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32Float64Err failed")
}
_, err = PMapInt32Float64Err(plusOneInt32Float64Err, []int32{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32Float64Err failed")
}
_, err = PMapInt32Float64Err(plusOneInt32Float64Err, []int32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt32Float64Err failed")
}
}
func TestPmapInt16IntErr(t *testing.T) {
// Test : add 1 to the list
expectedList := []int{2, 3}
newList, _ := PMapInt16IntErr(plusOneInt16IntErr, []int16{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapInt16Int failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapInt16IntErr(nil, nil)
if len(r) > 0 {
t.Errorf("PMapInt16IntErr failed")
}
r, _ = PMapInt16IntErr(nil, []int16{})
if len(r) > 0 {
t.Errorf("PMapInt16IntErr failed")
}
_, err := PMapInt16IntErr(plusOneInt16IntErr, []int16{1, 2, 3})
if err == nil {
t.Errorf("PMapInt16IntErr failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapInt16IntErr(plusOneInt16IntErr, []int16{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt16IntErr failed")
}
_, err = PMapInt16IntErr(plusOneInt16IntErr, []int16{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapInt16IntErr failed")
}
_, err = PMapInt16IntErr(plusOneInt16IntErr, []int16{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt16IntErr failed")
}
_, err = PMapInt16IntErr(plusOneInt16IntErr, []int16{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt16IntErr failed")
}
expectedList = []int{2, 3}
newList, _ = PMapInt16IntErr(plusOneInt16IntErr, []int16{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapInt16Int failed")
}
_, err = PMapInt16IntErr(plusOneInt16IntErr, []int16{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16IntErr failed")
}
_, err = PMapInt16IntErr(plusOneInt16IntErr, []int16{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16IntErr failed")
}
_, err = PMapInt16IntErr(plusOneInt16IntErr, []int16{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16IntErr failed")
}
_, err = PMapInt16IntErr(plusOneInt16IntErr, []int16{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16IntErr failed")
}
_, err = PMapInt16IntErr(plusOneInt16IntErr, []int16{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16IntErr failed")
}
}
func TestPmapInt16Int64Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []int64{2, 3}
newList, _ := PMapInt16Int64Err(plusOneInt16Int64Err, []int16{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapInt16Int64 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapInt16Int64Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapInt16Int64Err failed")
}
r, _ = PMapInt16Int64Err(nil, []int16{})
if len(r) > 0 {
t.Errorf("PMapInt16Int64Err failed")
}
_, err := PMapInt16Int64Err(plusOneInt16Int64Err, []int16{1, 2, 3})
if err == nil {
t.Errorf("PMapInt16Int64Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapInt16Int64Err(plusOneInt16Int64Err, []int16{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt16Int64Err failed")
}
_, err = PMapInt16Int64Err(plusOneInt16Int64Err, []int16{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapInt16Int64Err failed")
}
_, err = PMapInt16Int64Err(plusOneInt16Int64Err, []int16{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt16Int64Err failed")
}
_, err = PMapInt16Int64Err(plusOneInt16Int64Err, []int16{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt16Int64Err failed")
}
expectedList = []int64{2, 3}
newList, _ = PMapInt16Int64Err(plusOneInt16Int64Err, []int16{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapInt16Int64 failed")
}
_, err = PMapInt16Int64Err(plusOneInt16Int64Err, []int16{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16Int64Err failed")
}
_, err = PMapInt16Int64Err(plusOneInt16Int64Err, []int16{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16Int64Err failed")
}
_, err = PMapInt16Int64Err(plusOneInt16Int64Err, []int16{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16Int64Err failed")
}
_, err = PMapInt16Int64Err(plusOneInt16Int64Err, []int16{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16Int64Err failed")
}
_, err = PMapInt16Int64Err(plusOneInt16Int64Err, []int16{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16Int64Err failed")
}
}
func TestPmapInt16Int32Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []int32{2, 3}
newList, _ := PMapInt16Int32Err(plusOneInt16Int32Err, []int16{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapInt16Int32 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapInt16Int32Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapInt16Int32Err failed")
}
r, _ = PMapInt16Int32Err(nil, []int16{})
if len(r) > 0 {
t.Errorf("PMapInt16Int32Err failed")
}
_, err := PMapInt16Int32Err(plusOneInt16Int32Err, []int16{1, 2, 3})
if err == nil {
t.Errorf("PMapInt16Int32Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapInt16Int32Err(plusOneInt16Int32Err, []int16{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt16Int32Err failed")
}
_, err = PMapInt16Int32Err(plusOneInt16Int32Err, []int16{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapInt16Int32Err failed")
}
_, err = PMapInt16Int32Err(plusOneInt16Int32Err, []int16{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt16Int32Err failed")
}
_, err = PMapInt16Int32Err(plusOneInt16Int32Err, []int16{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt16Int32Err failed")
}
expectedList = []int32{2, 3}
newList, _ = PMapInt16Int32Err(plusOneInt16Int32Err, []int16{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapInt16Int32 failed")
}
_, err = PMapInt16Int32Err(plusOneInt16Int32Err, []int16{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16Int32Err failed")
}
_, err = PMapInt16Int32Err(plusOneInt16Int32Err, []int16{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16Int32Err failed")
}
_, err = PMapInt16Int32Err(plusOneInt16Int32Err, []int16{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16Int32Err failed")
}
_, err = PMapInt16Int32Err(plusOneInt16Int32Err, []int16{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16Int32Err failed")
}
_, err = PMapInt16Int32Err(plusOneInt16Int32Err, []int16{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16Int32Err failed")
}
}
func TestPmapInt16Int8Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []int8{2, 3}
newList, _ := PMapInt16Int8Err(plusOneInt16Int8Err, []int16{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapInt16Int8 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapInt16Int8Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapInt16Int8Err failed")
}
r, _ = PMapInt16Int8Err(nil, []int16{})
if len(r) > 0 {
t.Errorf("PMapInt16Int8Err failed")
}
_, err := PMapInt16Int8Err(plusOneInt16Int8Err, []int16{1, 2, 3})
if err == nil {
t.Errorf("PMapInt16Int8Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapInt16Int8Err(plusOneInt16Int8Err, []int16{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt16Int8Err failed")
}
_, err = PMapInt16Int8Err(plusOneInt16Int8Err, []int16{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapInt16Int8Err failed")
}
_, err = PMapInt16Int8Err(plusOneInt16Int8Err, []int16{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt16Int8Err failed")
}
_, err = PMapInt16Int8Err(plusOneInt16Int8Err, []int16{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt16Int8Err failed")
}
expectedList = []int8{2, 3}
newList, _ = PMapInt16Int8Err(plusOneInt16Int8Err, []int16{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapInt16Int8 failed")
}
_, err = PMapInt16Int8Err(plusOneInt16Int8Err, []int16{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16Int8Err failed")
}
_, err = PMapInt16Int8Err(plusOneInt16Int8Err, []int16{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16Int8Err failed")
}
_, err = PMapInt16Int8Err(plusOneInt16Int8Err, []int16{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16Int8Err failed")
}
_, err = PMapInt16Int8Err(plusOneInt16Int8Err, []int16{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16Int8Err failed")
}
_, err = PMapInt16Int8Err(plusOneInt16Int8Err, []int16{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16Int8Err failed")
}
}
func TestPmapInt16UintErr(t *testing.T) {
// Test : add 1 to the list
expectedList := []uint{2, 3}
newList, _ := PMapInt16UintErr(plusOneInt16UintErr, []int16{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapInt16Uint failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapInt16UintErr(nil, nil)
if len(r) > 0 {
t.Errorf("PMapInt16UintErr failed")
}
r, _ = PMapInt16UintErr(nil, []int16{})
if len(r) > 0 {
t.Errorf("PMapInt16UintErr failed")
}
_, err := PMapInt16UintErr(plusOneInt16UintErr, []int16{1, 2, 3})
if err == nil {
t.Errorf("PMapInt16UintErr failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapInt16UintErr(plusOneInt16UintErr, []int16{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt16UintErr failed")
}
_, err = PMapInt16UintErr(plusOneInt16UintErr, []int16{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapInt16UintErr failed")
}
_, err = PMapInt16UintErr(plusOneInt16UintErr, []int16{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt16UintErr failed")
}
_, err = PMapInt16UintErr(plusOneInt16UintErr, []int16{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt16UintErr failed")
}
expectedList = []uint{2, 3}
newList, _ = PMapInt16UintErr(plusOneInt16UintErr, []int16{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapInt16Uint failed")
}
_, err = PMapInt16UintErr(plusOneInt16UintErr, []int16{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16UintErr failed")
}
_, err = PMapInt16UintErr(plusOneInt16UintErr, []int16{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16UintErr failed")
}
_, err = PMapInt16UintErr(plusOneInt16UintErr, []int16{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16UintErr failed")
}
_, err = PMapInt16UintErr(plusOneInt16UintErr, []int16{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16UintErr failed")
}
_, err = PMapInt16UintErr(plusOneInt16UintErr, []int16{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16UintErr failed")
}
}
func TestPmapInt16Uint64Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []uint64{2, 3}
newList, _ := PMapInt16Uint64Err(plusOneInt16Uint64Err, []int16{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapInt16Uint64 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapInt16Uint64Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapInt16Uint64Err failed")
}
r, _ = PMapInt16Uint64Err(nil, []int16{})
if len(r) > 0 {
t.Errorf("PMapInt16Uint64Err failed")
}
_, err := PMapInt16Uint64Err(plusOneInt16Uint64Err, []int16{1, 2, 3})
if err == nil {
t.Errorf("PMapInt16Uint64Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapInt16Uint64Err(plusOneInt16Uint64Err, []int16{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt16Uint64Err failed")
}
_, err = PMapInt16Uint64Err(plusOneInt16Uint64Err, []int16{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapInt16Uint64Err failed")
}
_, err = PMapInt16Uint64Err(plusOneInt16Uint64Err, []int16{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt16Uint64Err failed")
}
_, err = PMapInt16Uint64Err(plusOneInt16Uint64Err, []int16{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt16Uint64Err failed")
}
expectedList = []uint64{2, 3}
newList, _ = PMapInt16Uint64Err(plusOneInt16Uint64Err, []int16{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapInt16Uint64 failed")
}
_, err = PMapInt16Uint64Err(plusOneInt16Uint64Err, []int16{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16Uint64Err failed")
}
_, err = PMapInt16Uint64Err(plusOneInt16Uint64Err, []int16{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16Uint64Err failed")
}
_, err = PMapInt16Uint64Err(plusOneInt16Uint64Err, []int16{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16Uint64Err failed")
}
_, err = PMapInt16Uint64Err(plusOneInt16Uint64Err, []int16{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16Uint64Err failed")
}
_, err = PMapInt16Uint64Err(plusOneInt16Uint64Err, []int16{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16Uint64Err failed")
}
}
func TestPmapInt16Uint32Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []uint32{2, 3}
newList, _ := PMapInt16Uint32Err(plusOneInt16Uint32Err, []int16{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapInt16Uint32 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapInt16Uint32Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapInt16Uint32Err failed")
}
r, _ = PMapInt16Uint32Err(nil, []int16{})
if len(r) > 0 {
t.Errorf("PMapInt16Uint32Err failed")
}
_, err := PMapInt16Uint32Err(plusOneInt16Uint32Err, []int16{1, 2, 3})
if err == nil {
t.Errorf("PMapInt16Uint32Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapInt16Uint32Err(plusOneInt16Uint32Err, []int16{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt16Uint32Err failed")
}
_, err = PMapInt16Uint32Err(plusOneInt16Uint32Err, []int16{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapInt16Uint32Err failed")
}
_, err = PMapInt16Uint32Err(plusOneInt16Uint32Err, []int16{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt16Uint32Err failed")
}
_, err = PMapInt16Uint32Err(plusOneInt16Uint32Err, []int16{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt16Uint32Err failed")
}
expectedList = []uint32{2, 3}
newList, _ = PMapInt16Uint32Err(plusOneInt16Uint32Err, []int16{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapInt16Uint32 failed")
}
_, err = PMapInt16Uint32Err(plusOneInt16Uint32Err, []int16{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16Uint32Err failed")
}
_, err = PMapInt16Uint32Err(plusOneInt16Uint32Err, []int16{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16Uint32Err failed")
}
_, err = PMapInt16Uint32Err(plusOneInt16Uint32Err, []int16{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16Uint32Err failed")
}
_, err = PMapInt16Uint32Err(plusOneInt16Uint32Err, []int16{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16Uint32Err failed")
}
_, err = PMapInt16Uint32Err(plusOneInt16Uint32Err, []int16{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16Uint32Err failed")
}
}
func TestPmapInt16Uint16Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []uint16{2, 3}
newList, _ := PMapInt16Uint16Err(plusOneInt16Uint16Err, []int16{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapInt16Uint16 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapInt16Uint16Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapInt16Uint16Err failed")
}
r, _ = PMapInt16Uint16Err(nil, []int16{})
if len(r) > 0 {
t.Errorf("PMapInt16Uint16Err failed")
}
_, err := PMapInt16Uint16Err(plusOneInt16Uint16Err, []int16{1, 2, 3})
if err == nil {
t.Errorf("PMapInt16Uint16Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapInt16Uint16Err(plusOneInt16Uint16Err, []int16{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt16Uint16Err failed")
}
_, err = PMapInt16Uint16Err(plusOneInt16Uint16Err, []int16{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapInt16Uint16Err failed")
}
_, err = PMapInt16Uint16Err(plusOneInt16Uint16Err, []int16{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt16Uint16Err failed")
}
_, err = PMapInt16Uint16Err(plusOneInt16Uint16Err, []int16{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt16Uint16Err failed")
}
expectedList = []uint16{2, 3}
newList, _ = PMapInt16Uint16Err(plusOneInt16Uint16Err, []int16{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapInt16Uint16 failed")
}
_, err = PMapInt16Uint16Err(plusOneInt16Uint16Err, []int16{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16Uint16Err failed")
}
_, err = PMapInt16Uint16Err(plusOneInt16Uint16Err, []int16{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16Uint16Err failed")
}
_, err = PMapInt16Uint16Err(plusOneInt16Uint16Err, []int16{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16Uint16Err failed")
}
_, err = PMapInt16Uint16Err(plusOneInt16Uint16Err, []int16{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16Uint16Err failed")
}
_, err = PMapInt16Uint16Err(plusOneInt16Uint16Err, []int16{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16Uint16Err failed")
}
}
func TestPmapInt16Uint8Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []uint8{2, 3}
newList, _ := PMapInt16Uint8Err(plusOneInt16Uint8Err, []int16{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapInt16Uint8 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapInt16Uint8Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapInt16Uint8Err failed")
}
r, _ = PMapInt16Uint8Err(nil, []int16{})
if len(r) > 0 {
t.Errorf("PMapInt16Uint8Err failed")
}
_, err := PMapInt16Uint8Err(plusOneInt16Uint8Err, []int16{1, 2, 3})
if err == nil {
t.Errorf("PMapInt16Uint8Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapInt16Uint8Err(plusOneInt16Uint8Err, []int16{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt16Uint8Err failed")
}
_, err = PMapInt16Uint8Err(plusOneInt16Uint8Err, []int16{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapInt16Uint8Err failed")
}
_, err = PMapInt16Uint8Err(plusOneInt16Uint8Err, []int16{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt16Uint8Err failed")
}
_, err = PMapInt16Uint8Err(plusOneInt16Uint8Err, []int16{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt16Uint8Err failed")
}
expectedList = []uint8{2, 3}
newList, _ = PMapInt16Uint8Err(plusOneInt16Uint8Err, []int16{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapInt16Uint8 failed")
}
_, err = PMapInt16Uint8Err(plusOneInt16Uint8Err, []int16{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16Uint8Err failed")
}
_, err = PMapInt16Uint8Err(plusOneInt16Uint8Err, []int16{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16Uint8Err failed")
}
_, err = PMapInt16Uint8Err(plusOneInt16Uint8Err, []int16{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16Uint8Err failed")
}
_, err = PMapInt16Uint8Err(plusOneInt16Uint8Err, []int16{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16Uint8Err failed")
}
_, err = PMapInt16Uint8Err(plusOneInt16Uint8Err, []int16{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16Uint8Err failed")
}
}
func TestPmapInt16StrErr(t *testing.T) {
// Test : someLogic
expectedList := []string{"10"}
newList, _ := PMapInt16StrErr(someLogicInt16StrErr, []int16{10})
if newList[0] != expectedList[0] {
t.Errorf("PMapInt16StrErr failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapInt16StrErr(nil, nil)
if len(r) > 0 {
t.Errorf("PMapInt16StrErr failed")
}
r, _ = PMapInt16StrErr(nil, []int16{})
if len(r) > 0 {
t.Errorf("PMapInt16StrErr failed")
}
_, err := PMapInt16StrErr(someLogicInt16StrErr, []int16{10, 0})
if err == nil {
t.Errorf("PMapInt16StrErr failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapInt16StrErr(someLogicInt16StrErr, []int16{10, 10, 0}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt16StrErr failed")
}
_, err = PMapInt16StrErr(someLogicInt16StrErr, []int16{0, 0, 10}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapInt16StrErr failed")
}
_, err = PMapInt16StrErr(someLogicInt16StrErr, []int16{0, 10, 0}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt16StrErr failed")
}
_, err = PMapInt16StrErr(someLogicInt16StrErr, []int16{10, 10, 0}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt16StrErr failed")
}
expectedList = []string{"10", "10"}
newList, _ = PMapInt16StrErr(someLogicInt16StrErr, []int16{10, 10}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapInt16Str failed")
}
_, err = PMapInt16StrErr(someLogicInt16StrErr, []int16{10, 10, 0}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16StrErr failed")
}
_, err = PMapInt16StrErr(someLogicInt16StrErr, []int16{10, 10, 0}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16StrErr failed")
}
_, err = PMapInt16StrErr(someLogicInt16StrErr, []int16{0, 0, 10}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16StrErr failed")
}
_, err = PMapInt16StrErr(someLogicInt16StrErr, []int16{0, 10, 0}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16StrErr failed")
}
_, err = PMapInt16StrErr(someLogicInt16StrErr, []int16{10, 10, 0}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16StrErr failed")
}
}
func TestPmapInt16BoolErr(t *testing.T) {
// Test : someLogic
expectedList := []bool{true, false}
newList, _ := PMapInt16BoolErr(someLogicInt16BoolErr, []int16{10, 0})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapInt16BoolErr failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapInt16BoolErr(nil, nil)
if len(r) > 0 {
t.Errorf("PMapInt16BoolErr failed")
}
r, _ = PMapInt16BoolErr(nil, []int16{})
if len(r) > 0 {
t.Errorf("PMapInt16BoolErr failed")
}
_, err := PMapInt16BoolErr(someLogicInt16BoolErr, []int16{10, 3, 3})
if err == nil {
t.Errorf("PMapInt16BoolErr failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapInt16BoolErr(someLogicInt16BoolErr, []int16{10, 10, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt16BoolErr failed")
}
_, err = PMapInt16BoolErr(someLogicInt16BoolErr, []int16{3, 3, 10}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapInt16BoolErr failed")
}
_, err = PMapInt16BoolErr(someLogicInt16BoolErr, []int16{3, 10, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt16BoolErr failed")
}
_, err = PMapInt16BoolErr(someLogicInt16BoolErr, []int16{10, 10, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt16BoolErr failed")
}
expectedList = []bool{true, true}
newList, _ = PMapInt16BoolErr(someLogicInt16BoolErr, []int16{10, 10}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapInt16Bool failed")
}
_, err = PMapInt16BoolErr(someLogicInt16BoolErr, []int16{10, 10, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16BoolErr failed")
}
_, err = PMapInt16BoolErr(someLogicInt16BoolErr, []int16{10, 10, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16BoolErr failed")
}
_, err = PMapInt16BoolErr(someLogicInt16BoolErr, []int16{3, 3, 10}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16BoolErr failed")
}
_, err = PMapInt16BoolErr(someLogicInt16BoolErr, []int16{3, 10, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16BoolErr failed")
}
_, err = PMapInt16BoolErr(someLogicInt16BoolErr, []int16{10, 10, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16BoolErr failed")
}
}
func TestPmapInt16Float32Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []float32{2, 3}
newList, _ := PMapInt16Float32Err(plusOneInt16Float32Err, []int16{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapInt16Float32 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapInt16Float32Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapInt16Float32Err failed")
}
r, _ = PMapInt16Float32Err(nil, []int16{})
if len(r) > 0 {
t.Errorf("PMapInt16Float32Err failed")
}
_, err := PMapInt16Float32Err(plusOneInt16Float32Err, []int16{1, 2, 3})
if err == nil {
t.Errorf("PMapInt16Float32Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapInt16Float32Err(plusOneInt16Float32Err, []int16{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt16Float32Err failed")
}
_, err = PMapInt16Float32Err(plusOneInt16Float32Err, []int16{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapInt16Float32Err failed")
}
_, err = PMapInt16Float32Err(plusOneInt16Float32Err, []int16{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt16Float32Err failed")
}
_, err = PMapInt16Float32Err(plusOneInt16Float32Err, []int16{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt16Float32Err failed")
}
expectedList = []float32{2, 3}
newList, _ = PMapInt16Float32Err(plusOneInt16Float32Err, []int16{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapInt16Float32 failed")
}
_, err = PMapInt16Float32Err(plusOneInt16Float32Err, []int16{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16Float32Err failed")
}
_, err = PMapInt16Float32Err(plusOneInt16Float32Err, []int16{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16Float32Err failed")
}
_, err = PMapInt16Float32Err(plusOneInt16Float32Err, []int16{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16Float32Err failed")
}
_, err = PMapInt16Float32Err(plusOneInt16Float32Err, []int16{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16Float32Err failed")
}
_, err = PMapInt16Float32Err(plusOneInt16Float32Err, []int16{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16Float32Err failed")
}
}
func TestPmapInt16Float64Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []float64{2, 3}
newList, _ := PMapInt16Float64Err(plusOneInt16Float64Err, []int16{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapInt16Float64 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapInt16Float64Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapInt16Float64Err failed")
}
r, _ = PMapInt16Float64Err(nil, []int16{})
if len(r) > 0 {
t.Errorf("PMapInt16Float64Err failed")
}
_, err := PMapInt16Float64Err(plusOneInt16Float64Err, []int16{1, 2, 3})
if err == nil {
t.Errorf("PMapInt16Float64Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapInt16Float64Err(plusOneInt16Float64Err, []int16{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt16Float64Err failed")
}
_, err = PMapInt16Float64Err(plusOneInt16Float64Err, []int16{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapInt16Float64Err failed")
}
_, err = PMapInt16Float64Err(plusOneInt16Float64Err, []int16{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt16Float64Err failed")
}
_, err = PMapInt16Float64Err(plusOneInt16Float64Err, []int16{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt16Float64Err failed")
}
expectedList = []float64{2, 3}
newList, _ = PMapInt16Float64Err(plusOneInt16Float64Err, []int16{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapInt16Float64 failed")
}
_, err = PMapInt16Float64Err(plusOneInt16Float64Err, []int16{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16Float64Err failed")
}
_, err = PMapInt16Float64Err(plusOneInt16Float64Err, []int16{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16Float64Err failed")
}
_, err = PMapInt16Float64Err(plusOneInt16Float64Err, []int16{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16Float64Err failed")
}
_, err = PMapInt16Float64Err(plusOneInt16Float64Err, []int16{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16Float64Err failed")
}
_, err = PMapInt16Float64Err(plusOneInt16Float64Err, []int16{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt16Float64Err failed")
}
}
func TestPmapInt8IntErr(t *testing.T) {
// Test : add 1 to the list
expectedList := []int{2, 3}
newList, _ := PMapInt8IntErr(plusOneInt8IntErr, []int8{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapInt8Int failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapInt8IntErr(nil, nil)
if len(r) > 0 {
t.Errorf("PMapInt8IntErr failed")
}
r, _ = PMapInt8IntErr(nil, []int8{})
if len(r) > 0 {
t.Errorf("PMapInt8IntErr failed")
}
_, err := PMapInt8IntErr(plusOneInt8IntErr, []int8{1, 2, 3})
if err == nil {
t.Errorf("PMapInt8IntErr failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapInt8IntErr(plusOneInt8IntErr, []int8{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt8IntErr failed")
}
_, err = PMapInt8IntErr(plusOneInt8IntErr, []int8{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapInt8IntErr failed")
}
_, err = PMapInt8IntErr(plusOneInt8IntErr, []int8{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt8IntErr failed")
}
_, err = PMapInt8IntErr(plusOneInt8IntErr, []int8{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt8IntErr failed")
}
expectedList = []int{2, 3}
newList, _ = PMapInt8IntErr(plusOneInt8IntErr, []int8{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapInt8Int failed")
}
_, err = PMapInt8IntErr(plusOneInt8IntErr, []int8{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8IntErr failed")
}
_, err = PMapInt8IntErr(plusOneInt8IntErr, []int8{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8IntErr failed")
}
_, err = PMapInt8IntErr(plusOneInt8IntErr, []int8{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8IntErr failed")
}
_, err = PMapInt8IntErr(plusOneInt8IntErr, []int8{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8IntErr failed")
}
_, err = PMapInt8IntErr(plusOneInt8IntErr, []int8{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8IntErr failed")
}
}
func TestPmapInt8Int64Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []int64{2, 3}
newList, _ := PMapInt8Int64Err(plusOneInt8Int64Err, []int8{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapInt8Int64 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapInt8Int64Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapInt8Int64Err failed")
}
r, _ = PMapInt8Int64Err(nil, []int8{})
if len(r) > 0 {
t.Errorf("PMapInt8Int64Err failed")
}
_, err := PMapInt8Int64Err(plusOneInt8Int64Err, []int8{1, 2, 3})
if err == nil {
t.Errorf("PMapInt8Int64Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapInt8Int64Err(plusOneInt8Int64Err, []int8{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt8Int64Err failed")
}
_, err = PMapInt8Int64Err(plusOneInt8Int64Err, []int8{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapInt8Int64Err failed")
}
_, err = PMapInt8Int64Err(plusOneInt8Int64Err, []int8{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt8Int64Err failed")
}
_, err = PMapInt8Int64Err(plusOneInt8Int64Err, []int8{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt8Int64Err failed")
}
expectedList = []int64{2, 3}
newList, _ = PMapInt8Int64Err(plusOneInt8Int64Err, []int8{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapInt8Int64 failed")
}
_, err = PMapInt8Int64Err(plusOneInt8Int64Err, []int8{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8Int64Err failed")
}
_, err = PMapInt8Int64Err(plusOneInt8Int64Err, []int8{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8Int64Err failed")
}
_, err = PMapInt8Int64Err(plusOneInt8Int64Err, []int8{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8Int64Err failed")
}
_, err = PMapInt8Int64Err(plusOneInt8Int64Err, []int8{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8Int64Err failed")
}
_, err = PMapInt8Int64Err(plusOneInt8Int64Err, []int8{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8Int64Err failed")
}
}
func TestPmapInt8Int32Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []int32{2, 3}
newList, _ := PMapInt8Int32Err(plusOneInt8Int32Err, []int8{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapInt8Int32 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapInt8Int32Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapInt8Int32Err failed")
}
r, _ = PMapInt8Int32Err(nil, []int8{})
if len(r) > 0 {
t.Errorf("PMapInt8Int32Err failed")
}
_, err := PMapInt8Int32Err(plusOneInt8Int32Err, []int8{1, 2, 3})
if err == nil {
t.Errorf("PMapInt8Int32Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapInt8Int32Err(plusOneInt8Int32Err, []int8{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt8Int32Err failed")
}
_, err = PMapInt8Int32Err(plusOneInt8Int32Err, []int8{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapInt8Int32Err failed")
}
_, err = PMapInt8Int32Err(plusOneInt8Int32Err, []int8{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt8Int32Err failed")
}
_, err = PMapInt8Int32Err(plusOneInt8Int32Err, []int8{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt8Int32Err failed")
}
expectedList = []int32{2, 3}
newList, _ = PMapInt8Int32Err(plusOneInt8Int32Err, []int8{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapInt8Int32 failed")
}
_, err = PMapInt8Int32Err(plusOneInt8Int32Err, []int8{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8Int32Err failed")
}
_, err = PMapInt8Int32Err(plusOneInt8Int32Err, []int8{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8Int32Err failed")
}
_, err = PMapInt8Int32Err(plusOneInt8Int32Err, []int8{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8Int32Err failed")
}
_, err = PMapInt8Int32Err(plusOneInt8Int32Err, []int8{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8Int32Err failed")
}
_, err = PMapInt8Int32Err(plusOneInt8Int32Err, []int8{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8Int32Err failed")
}
}
func TestPmapInt8Int16Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []int16{2, 3}
newList, _ := PMapInt8Int16Err(plusOneInt8Int16Err, []int8{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapInt8Int16 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapInt8Int16Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapInt8Int16Err failed")
}
r, _ = PMapInt8Int16Err(nil, []int8{})
if len(r) > 0 {
t.Errorf("PMapInt8Int16Err failed")
}
_, err := PMapInt8Int16Err(plusOneInt8Int16Err, []int8{1, 2, 3})
if err == nil {
t.Errorf("PMapInt8Int16Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapInt8Int16Err(plusOneInt8Int16Err, []int8{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt8Int16Err failed")
}
_, err = PMapInt8Int16Err(plusOneInt8Int16Err, []int8{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapInt8Int16Err failed")
}
_, err = PMapInt8Int16Err(plusOneInt8Int16Err, []int8{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt8Int16Err failed")
}
_, err = PMapInt8Int16Err(plusOneInt8Int16Err, []int8{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt8Int16Err failed")
}
expectedList = []int16{2, 3}
newList, _ = PMapInt8Int16Err(plusOneInt8Int16Err, []int8{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapInt8Int16 failed")
}
_, err = PMapInt8Int16Err(plusOneInt8Int16Err, []int8{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8Int16Err failed")
}
_, err = PMapInt8Int16Err(plusOneInt8Int16Err, []int8{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8Int16Err failed")
}
_, err = PMapInt8Int16Err(plusOneInt8Int16Err, []int8{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8Int16Err failed")
}
_, err = PMapInt8Int16Err(plusOneInt8Int16Err, []int8{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8Int16Err failed")
}
_, err = PMapInt8Int16Err(plusOneInt8Int16Err, []int8{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8Int16Err failed")
}
}
func TestPmapInt8UintErr(t *testing.T) {
// Test : add 1 to the list
expectedList := []uint{2, 3}
newList, _ := PMapInt8UintErr(plusOneInt8UintErr, []int8{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapInt8Uint failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapInt8UintErr(nil, nil)
if len(r) > 0 {
t.Errorf("PMapInt8UintErr failed")
}
r, _ = PMapInt8UintErr(nil, []int8{})
if len(r) > 0 {
t.Errorf("PMapInt8UintErr failed")
}
_, err := PMapInt8UintErr(plusOneInt8UintErr, []int8{1, 2, 3})
if err == nil {
t.Errorf("PMapInt8UintErr failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapInt8UintErr(plusOneInt8UintErr, []int8{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt8UintErr failed")
}
_, err = PMapInt8UintErr(plusOneInt8UintErr, []int8{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapInt8UintErr failed")
}
_, err = PMapInt8UintErr(plusOneInt8UintErr, []int8{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt8UintErr failed")
}
_, err = PMapInt8UintErr(plusOneInt8UintErr, []int8{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt8UintErr failed")
}
expectedList = []uint{2, 3}
newList, _ = PMapInt8UintErr(plusOneInt8UintErr, []int8{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapInt8Uint failed")
}
_, err = PMapInt8UintErr(plusOneInt8UintErr, []int8{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8UintErr failed")
}
_, err = PMapInt8UintErr(plusOneInt8UintErr, []int8{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8UintErr failed")
}
_, err = PMapInt8UintErr(plusOneInt8UintErr, []int8{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8UintErr failed")
}
_, err = PMapInt8UintErr(plusOneInt8UintErr, []int8{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8UintErr failed")
}
_, err = PMapInt8UintErr(plusOneInt8UintErr, []int8{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8UintErr failed")
}
}
func TestPmapInt8Uint64Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []uint64{2, 3}
newList, _ := PMapInt8Uint64Err(plusOneInt8Uint64Err, []int8{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapInt8Uint64 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapInt8Uint64Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapInt8Uint64Err failed")
}
r, _ = PMapInt8Uint64Err(nil, []int8{})
if len(r) > 0 {
t.Errorf("PMapInt8Uint64Err failed")
}
_, err := PMapInt8Uint64Err(plusOneInt8Uint64Err, []int8{1, 2, 3})
if err == nil {
t.Errorf("PMapInt8Uint64Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapInt8Uint64Err(plusOneInt8Uint64Err, []int8{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt8Uint64Err failed")
}
_, err = PMapInt8Uint64Err(plusOneInt8Uint64Err, []int8{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapInt8Uint64Err failed")
}
_, err = PMapInt8Uint64Err(plusOneInt8Uint64Err, []int8{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt8Uint64Err failed")
}
_, err = PMapInt8Uint64Err(plusOneInt8Uint64Err, []int8{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt8Uint64Err failed")
}
expectedList = []uint64{2, 3}
newList, _ = PMapInt8Uint64Err(plusOneInt8Uint64Err, []int8{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapInt8Uint64 failed")
}
_, err = PMapInt8Uint64Err(plusOneInt8Uint64Err, []int8{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8Uint64Err failed")
}
_, err = PMapInt8Uint64Err(plusOneInt8Uint64Err, []int8{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8Uint64Err failed")
}
_, err = PMapInt8Uint64Err(plusOneInt8Uint64Err, []int8{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8Uint64Err failed")
}
_, err = PMapInt8Uint64Err(plusOneInt8Uint64Err, []int8{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8Uint64Err failed")
}
_, err = PMapInt8Uint64Err(plusOneInt8Uint64Err, []int8{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8Uint64Err failed")
}
}
func TestPmapInt8Uint32Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []uint32{2, 3}
newList, _ := PMapInt8Uint32Err(plusOneInt8Uint32Err, []int8{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapInt8Uint32 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapInt8Uint32Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapInt8Uint32Err failed")
}
r, _ = PMapInt8Uint32Err(nil, []int8{})
if len(r) > 0 {
t.Errorf("PMapInt8Uint32Err failed")
}
_, err := PMapInt8Uint32Err(plusOneInt8Uint32Err, []int8{1, 2, 3})
if err == nil {
t.Errorf("PMapInt8Uint32Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapInt8Uint32Err(plusOneInt8Uint32Err, []int8{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt8Uint32Err failed")
}
_, err = PMapInt8Uint32Err(plusOneInt8Uint32Err, []int8{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapInt8Uint32Err failed")
}
_, err = PMapInt8Uint32Err(plusOneInt8Uint32Err, []int8{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt8Uint32Err failed")
}
_, err = PMapInt8Uint32Err(plusOneInt8Uint32Err, []int8{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt8Uint32Err failed")
}
expectedList = []uint32{2, 3}
newList, _ = PMapInt8Uint32Err(plusOneInt8Uint32Err, []int8{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapInt8Uint32 failed")
}
_, err = PMapInt8Uint32Err(plusOneInt8Uint32Err, []int8{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8Uint32Err failed")
}
_, err = PMapInt8Uint32Err(plusOneInt8Uint32Err, []int8{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8Uint32Err failed")
}
_, err = PMapInt8Uint32Err(plusOneInt8Uint32Err, []int8{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8Uint32Err failed")
}
_, err = PMapInt8Uint32Err(plusOneInt8Uint32Err, []int8{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8Uint32Err failed")
}
_, err = PMapInt8Uint32Err(plusOneInt8Uint32Err, []int8{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8Uint32Err failed")
}
}
func TestPmapInt8Uint16Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []uint16{2, 3}
newList, _ := PMapInt8Uint16Err(plusOneInt8Uint16Err, []int8{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapInt8Uint16 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapInt8Uint16Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapInt8Uint16Err failed")
}
r, _ = PMapInt8Uint16Err(nil, []int8{})
if len(r) > 0 {
t.Errorf("PMapInt8Uint16Err failed")
}
_, err := PMapInt8Uint16Err(plusOneInt8Uint16Err, []int8{1, 2, 3})
if err == nil {
t.Errorf("PMapInt8Uint16Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapInt8Uint16Err(plusOneInt8Uint16Err, []int8{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt8Uint16Err failed")
}
_, err = PMapInt8Uint16Err(plusOneInt8Uint16Err, []int8{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapInt8Uint16Err failed")
}
_, err = PMapInt8Uint16Err(plusOneInt8Uint16Err, []int8{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt8Uint16Err failed")
}
_, err = PMapInt8Uint16Err(plusOneInt8Uint16Err, []int8{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt8Uint16Err failed")
}
expectedList = []uint16{2, 3}
newList, _ = PMapInt8Uint16Err(plusOneInt8Uint16Err, []int8{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapInt8Uint16 failed")
}
_, err = PMapInt8Uint16Err(plusOneInt8Uint16Err, []int8{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8Uint16Err failed")
}
_, err = PMapInt8Uint16Err(plusOneInt8Uint16Err, []int8{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8Uint16Err failed")
}
_, err = PMapInt8Uint16Err(plusOneInt8Uint16Err, []int8{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8Uint16Err failed")
}
_, err = PMapInt8Uint16Err(plusOneInt8Uint16Err, []int8{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8Uint16Err failed")
}
_, err = PMapInt8Uint16Err(plusOneInt8Uint16Err, []int8{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8Uint16Err failed")
}
}
func TestPmapInt8Uint8Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []uint8{2, 3}
newList, _ := PMapInt8Uint8Err(plusOneInt8Uint8Err, []int8{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapInt8Uint8 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapInt8Uint8Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapInt8Uint8Err failed")
}
r, _ = PMapInt8Uint8Err(nil, []int8{})
if len(r) > 0 {
t.Errorf("PMapInt8Uint8Err failed")
}
_, err := PMapInt8Uint8Err(plusOneInt8Uint8Err, []int8{1, 2, 3})
if err == nil {
t.Errorf("PMapInt8Uint8Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapInt8Uint8Err(plusOneInt8Uint8Err, []int8{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt8Uint8Err failed")
}
_, err = PMapInt8Uint8Err(plusOneInt8Uint8Err, []int8{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapInt8Uint8Err failed")
}
_, err = PMapInt8Uint8Err(plusOneInt8Uint8Err, []int8{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt8Uint8Err failed")
}
_, err = PMapInt8Uint8Err(plusOneInt8Uint8Err, []int8{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt8Uint8Err failed")
}
expectedList = []uint8{2, 3}
newList, _ = PMapInt8Uint8Err(plusOneInt8Uint8Err, []int8{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapInt8Uint8 failed")
}
_, err = PMapInt8Uint8Err(plusOneInt8Uint8Err, []int8{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8Uint8Err failed")
}
_, err = PMapInt8Uint8Err(plusOneInt8Uint8Err, []int8{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8Uint8Err failed")
}
_, err = PMapInt8Uint8Err(plusOneInt8Uint8Err, []int8{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8Uint8Err failed")
}
_, err = PMapInt8Uint8Err(plusOneInt8Uint8Err, []int8{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8Uint8Err failed")
}
_, err = PMapInt8Uint8Err(plusOneInt8Uint8Err, []int8{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8Uint8Err failed")
}
}
func TestPmapInt8StrErr(t *testing.T) {
// Test : someLogic
expectedList := []string{"10"}
newList, _ := PMapInt8StrErr(someLogicInt8StrErr, []int8{10})
if newList[0] != expectedList[0] {
t.Errorf("PMapInt8StrErr failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapInt8StrErr(nil, nil)
if len(r) > 0 {
t.Errorf("PMapInt8StrErr failed")
}
r, _ = PMapInt8StrErr(nil, []int8{})
if len(r) > 0 {
t.Errorf("PMapInt8StrErr failed")
}
_, err := PMapInt8StrErr(someLogicInt8StrErr, []int8{10, 0})
if err == nil {
t.Errorf("PMapInt8StrErr failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapInt8StrErr(someLogicInt8StrErr, []int8{10, 10, 0}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt8StrErr failed")
}
_, err = PMapInt8StrErr(someLogicInt8StrErr, []int8{0, 0, 10}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapInt8StrErr failed")
}
_, err = PMapInt8StrErr(someLogicInt8StrErr, []int8{0, 10, 0}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt8StrErr failed")
}
_, err = PMapInt8StrErr(someLogicInt8StrErr, []int8{10, 10, 0}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt8StrErr failed")
}
expectedList = []string{"10", "10"}
newList, _ = PMapInt8StrErr(someLogicInt8StrErr, []int8{10, 10}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapInt8Str failed")
}
_, err = PMapInt8StrErr(someLogicInt8StrErr, []int8{10, 10, 0}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8StrErr failed")
}
_, err = PMapInt8StrErr(someLogicInt8StrErr, []int8{10, 10, 0}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8StrErr failed")
}
_, err = PMapInt8StrErr(someLogicInt8StrErr, []int8{0, 0, 10}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8StrErr failed")
}
_, err = PMapInt8StrErr(someLogicInt8StrErr, []int8{0, 10, 0}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8StrErr failed")
}
_, err = PMapInt8StrErr(someLogicInt8StrErr, []int8{10, 10, 0}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8StrErr failed")
}
}
func TestPmapInt8BoolErr(t *testing.T) {
// Test : someLogic
expectedList := []bool{true, false}
newList, _ := PMapInt8BoolErr(someLogicInt8BoolErr, []int8{10, 0})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapInt8BoolErr failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapInt8BoolErr(nil, nil)
if len(r) > 0 {
t.Errorf("PMapInt8BoolErr failed")
}
r, _ = PMapInt8BoolErr(nil, []int8{})
if len(r) > 0 {
t.Errorf("PMapInt8BoolErr failed")
}
_, err := PMapInt8BoolErr(someLogicInt8BoolErr, []int8{10, 3, 3})
if err == nil {
t.Errorf("PMapInt8BoolErr failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapInt8BoolErr(someLogicInt8BoolErr, []int8{10, 10, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt8BoolErr failed")
}
_, err = PMapInt8BoolErr(someLogicInt8BoolErr, []int8{3, 3, 10}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapInt8BoolErr failed")
}
_, err = PMapInt8BoolErr(someLogicInt8BoolErr, []int8{3, 10, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt8BoolErr failed")
}
_, err = PMapInt8BoolErr(someLogicInt8BoolErr, []int8{10, 10, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt8BoolErr failed")
}
expectedList = []bool{true, true}
newList, _ = PMapInt8BoolErr(someLogicInt8BoolErr, []int8{10, 10}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapInt8Bool failed")
}
_, err = PMapInt8BoolErr(someLogicInt8BoolErr, []int8{10, 10, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8BoolErr failed")
}
_, err = PMapInt8BoolErr(someLogicInt8BoolErr, []int8{10, 10, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8BoolErr failed")
}
_, err = PMapInt8BoolErr(someLogicInt8BoolErr, []int8{3, 3, 10}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8BoolErr failed")
}
_, err = PMapInt8BoolErr(someLogicInt8BoolErr, []int8{3, 10, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8BoolErr failed")
}
_, err = PMapInt8BoolErr(someLogicInt8BoolErr, []int8{10, 10, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8BoolErr failed")
}
}
func TestPmapInt8Float32Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []float32{2, 3}
newList, _ := PMapInt8Float32Err(plusOneInt8Float32Err, []int8{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapInt8Float32 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapInt8Float32Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapInt8Float32Err failed")
}
r, _ = PMapInt8Float32Err(nil, []int8{})
if len(r) > 0 {
t.Errorf("PMapInt8Float32Err failed")
}
_, err := PMapInt8Float32Err(plusOneInt8Float32Err, []int8{1, 2, 3})
if err == nil {
t.Errorf("PMapInt8Float32Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapInt8Float32Err(plusOneInt8Float32Err, []int8{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt8Float32Err failed")
}
_, err = PMapInt8Float32Err(plusOneInt8Float32Err, []int8{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapInt8Float32Err failed")
}
_, err = PMapInt8Float32Err(plusOneInt8Float32Err, []int8{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt8Float32Err failed")
}
_, err = PMapInt8Float32Err(plusOneInt8Float32Err, []int8{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt8Float32Err failed")
}
expectedList = []float32{2, 3}
newList, _ = PMapInt8Float32Err(plusOneInt8Float32Err, []int8{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapInt8Float32 failed")
}
_, err = PMapInt8Float32Err(plusOneInt8Float32Err, []int8{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8Float32Err failed")
}
_, err = PMapInt8Float32Err(plusOneInt8Float32Err, []int8{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8Float32Err failed")
}
_, err = PMapInt8Float32Err(plusOneInt8Float32Err, []int8{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8Float32Err failed")
}
_, err = PMapInt8Float32Err(plusOneInt8Float32Err, []int8{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8Float32Err failed")
}
_, err = PMapInt8Float32Err(plusOneInt8Float32Err, []int8{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8Float32Err failed")
}
}
func TestPmapInt8Float64Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []float64{2, 3}
newList, _ := PMapInt8Float64Err(plusOneInt8Float64Err, []int8{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapInt8Float64 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapInt8Float64Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapInt8Float64Err failed")
}
r, _ = PMapInt8Float64Err(nil, []int8{})
if len(r) > 0 {
t.Errorf("PMapInt8Float64Err failed")
}
_, err := PMapInt8Float64Err(plusOneInt8Float64Err, []int8{1, 2, 3})
if err == nil {
t.Errorf("PMapInt8Float64Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapInt8Float64Err(plusOneInt8Float64Err, []int8{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt8Float64Err failed")
}
_, err = PMapInt8Float64Err(plusOneInt8Float64Err, []int8{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapInt8Float64Err failed")
}
_, err = PMapInt8Float64Err(plusOneInt8Float64Err, []int8{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt8Float64Err failed")
}
_, err = PMapInt8Float64Err(plusOneInt8Float64Err, []int8{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapInt8Float64Err failed")
}
expectedList = []float64{2, 3}
newList, _ = PMapInt8Float64Err(plusOneInt8Float64Err, []int8{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapInt8Float64 failed")
}
_, err = PMapInt8Float64Err(plusOneInt8Float64Err, []int8{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8Float64Err failed")
}
_, err = PMapInt8Float64Err(plusOneInt8Float64Err, []int8{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8Float64Err failed")
}
_, err = PMapInt8Float64Err(plusOneInt8Float64Err, []int8{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8Float64Err failed")
}
_, err = PMapInt8Float64Err(plusOneInt8Float64Err, []int8{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8Float64Err failed")
}
_, err = PMapInt8Float64Err(plusOneInt8Float64Err, []int8{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapInt8Float64Err failed")
}
}
func TestPmapUintIntErr(t *testing.T) {
// Test : add 1 to the list
expectedList := []int{2, 3}
newList, _ := PMapUintIntErr(plusOneUintIntErr, []uint{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUintInt failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUintIntErr(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUintIntErr failed")
}
r, _ = PMapUintIntErr(nil, []uint{})
if len(r) > 0 {
t.Errorf("PMapUintIntErr failed")
}
_, err := PMapUintIntErr(plusOneUintIntErr, []uint{1, 2, 3})
if err == nil {
t.Errorf("PMapUintIntErr failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUintIntErr(plusOneUintIntErr, []uint{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUintIntErr failed")
}
_, err = PMapUintIntErr(plusOneUintIntErr, []uint{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUintIntErr failed")
}
_, err = PMapUintIntErr(plusOneUintIntErr, []uint{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUintIntErr failed")
}
_, err = PMapUintIntErr(plusOneUintIntErr, []uint{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUintIntErr failed")
}
expectedList = []int{2, 3}
newList, _ = PMapUintIntErr(plusOneUintIntErr, []uint{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUintInt failed")
}
_, err = PMapUintIntErr(plusOneUintIntErr, []uint{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintIntErr failed")
}
_, err = PMapUintIntErr(plusOneUintIntErr, []uint{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintIntErr failed")
}
_, err = PMapUintIntErr(plusOneUintIntErr, []uint{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintIntErr failed")
}
_, err = PMapUintIntErr(plusOneUintIntErr, []uint{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintIntErr failed")
}
_, err = PMapUintIntErr(plusOneUintIntErr, []uint{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintIntErr failed")
}
}
func TestPmapUintInt64Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []int64{2, 3}
newList, _ := PMapUintInt64Err(plusOneUintInt64Err, []uint{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUintInt64 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUintInt64Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUintInt64Err failed")
}
r, _ = PMapUintInt64Err(nil, []uint{})
if len(r) > 0 {
t.Errorf("PMapUintInt64Err failed")
}
_, err := PMapUintInt64Err(plusOneUintInt64Err, []uint{1, 2, 3})
if err == nil {
t.Errorf("PMapUintInt64Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUintInt64Err(plusOneUintInt64Err, []uint{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUintInt64Err failed")
}
_, err = PMapUintInt64Err(plusOneUintInt64Err, []uint{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUintInt64Err failed")
}
_, err = PMapUintInt64Err(plusOneUintInt64Err, []uint{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUintInt64Err failed")
}
_, err = PMapUintInt64Err(plusOneUintInt64Err, []uint{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUintInt64Err failed")
}
expectedList = []int64{2, 3}
newList, _ = PMapUintInt64Err(plusOneUintInt64Err, []uint{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUintInt64 failed")
}
_, err = PMapUintInt64Err(plusOneUintInt64Err, []uint{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintInt64Err failed")
}
_, err = PMapUintInt64Err(plusOneUintInt64Err, []uint{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintInt64Err failed")
}
_, err = PMapUintInt64Err(plusOneUintInt64Err, []uint{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintInt64Err failed")
}
_, err = PMapUintInt64Err(plusOneUintInt64Err, []uint{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintInt64Err failed")
}
_, err = PMapUintInt64Err(plusOneUintInt64Err, []uint{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintInt64Err failed")
}
}
func TestPmapUintInt32Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []int32{2, 3}
newList, _ := PMapUintInt32Err(plusOneUintInt32Err, []uint{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUintInt32 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUintInt32Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUintInt32Err failed")
}
r, _ = PMapUintInt32Err(nil, []uint{})
if len(r) > 0 {
t.Errorf("PMapUintInt32Err failed")
}
_, err := PMapUintInt32Err(plusOneUintInt32Err, []uint{1, 2, 3})
if err == nil {
t.Errorf("PMapUintInt32Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUintInt32Err(plusOneUintInt32Err, []uint{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUintInt32Err failed")
}
_, err = PMapUintInt32Err(plusOneUintInt32Err, []uint{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUintInt32Err failed")
}
_, err = PMapUintInt32Err(plusOneUintInt32Err, []uint{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUintInt32Err failed")
}
_, err = PMapUintInt32Err(plusOneUintInt32Err, []uint{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUintInt32Err failed")
}
expectedList = []int32{2, 3}
newList, _ = PMapUintInt32Err(plusOneUintInt32Err, []uint{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUintInt32 failed")
}
_, err = PMapUintInt32Err(plusOneUintInt32Err, []uint{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintInt32Err failed")
}
_, err = PMapUintInt32Err(plusOneUintInt32Err, []uint{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintInt32Err failed")
}
_, err = PMapUintInt32Err(plusOneUintInt32Err, []uint{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintInt32Err failed")
}
_, err = PMapUintInt32Err(plusOneUintInt32Err, []uint{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintInt32Err failed")
}
_, err = PMapUintInt32Err(plusOneUintInt32Err, []uint{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintInt32Err failed")
}
}
func TestPmapUintInt16Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []int16{2, 3}
newList, _ := PMapUintInt16Err(plusOneUintInt16Err, []uint{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUintInt16 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUintInt16Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUintInt16Err failed")
}
r, _ = PMapUintInt16Err(nil, []uint{})
if len(r) > 0 {
t.Errorf("PMapUintInt16Err failed")
}
_, err := PMapUintInt16Err(plusOneUintInt16Err, []uint{1, 2, 3})
if err == nil {
t.Errorf("PMapUintInt16Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUintInt16Err(plusOneUintInt16Err, []uint{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUintInt16Err failed")
}
_, err = PMapUintInt16Err(plusOneUintInt16Err, []uint{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUintInt16Err failed")
}
_, err = PMapUintInt16Err(plusOneUintInt16Err, []uint{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUintInt16Err failed")
}
_, err = PMapUintInt16Err(plusOneUintInt16Err, []uint{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUintInt16Err failed")
}
expectedList = []int16{2, 3}
newList, _ = PMapUintInt16Err(plusOneUintInt16Err, []uint{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUintInt16 failed")
}
_, err = PMapUintInt16Err(plusOneUintInt16Err, []uint{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintInt16Err failed")
}
_, err = PMapUintInt16Err(plusOneUintInt16Err, []uint{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintInt16Err failed")
}
_, err = PMapUintInt16Err(plusOneUintInt16Err, []uint{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintInt16Err failed")
}
_, err = PMapUintInt16Err(plusOneUintInt16Err, []uint{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintInt16Err failed")
}
_, err = PMapUintInt16Err(plusOneUintInt16Err, []uint{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintInt16Err failed")
}
}
func TestPmapUintInt8Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []int8{2, 3}
newList, _ := PMapUintInt8Err(plusOneUintInt8Err, []uint{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUintInt8 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUintInt8Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUintInt8Err failed")
}
r, _ = PMapUintInt8Err(nil, []uint{})
if len(r) > 0 {
t.Errorf("PMapUintInt8Err failed")
}
_, err := PMapUintInt8Err(plusOneUintInt8Err, []uint{1, 2, 3})
if err == nil {
t.Errorf("PMapUintInt8Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUintInt8Err(plusOneUintInt8Err, []uint{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUintInt8Err failed")
}
_, err = PMapUintInt8Err(plusOneUintInt8Err, []uint{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUintInt8Err failed")
}
_, err = PMapUintInt8Err(plusOneUintInt8Err, []uint{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUintInt8Err failed")
}
_, err = PMapUintInt8Err(plusOneUintInt8Err, []uint{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUintInt8Err failed")
}
expectedList = []int8{2, 3}
newList, _ = PMapUintInt8Err(plusOneUintInt8Err, []uint{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUintInt8 failed")
}
_, err = PMapUintInt8Err(plusOneUintInt8Err, []uint{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintInt8Err failed")
}
_, err = PMapUintInt8Err(plusOneUintInt8Err, []uint{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintInt8Err failed")
}
_, err = PMapUintInt8Err(plusOneUintInt8Err, []uint{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintInt8Err failed")
}
_, err = PMapUintInt8Err(plusOneUintInt8Err, []uint{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintInt8Err failed")
}
_, err = PMapUintInt8Err(plusOneUintInt8Err, []uint{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintInt8Err failed")
}
}
func TestPmapUintUint64Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []uint64{2, 3}
newList, _ := PMapUintUint64Err(plusOneUintUint64Err, []uint{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUintUint64 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUintUint64Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUintUint64Err failed")
}
r, _ = PMapUintUint64Err(nil, []uint{})
if len(r) > 0 {
t.Errorf("PMapUintUint64Err failed")
}
_, err := PMapUintUint64Err(plusOneUintUint64Err, []uint{1, 2, 3})
if err == nil {
t.Errorf("PMapUintUint64Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUintUint64Err(plusOneUintUint64Err, []uint{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUintUint64Err failed")
}
_, err = PMapUintUint64Err(plusOneUintUint64Err, []uint{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUintUint64Err failed")
}
_, err = PMapUintUint64Err(plusOneUintUint64Err, []uint{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUintUint64Err failed")
}
_, err = PMapUintUint64Err(plusOneUintUint64Err, []uint{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUintUint64Err failed")
}
expectedList = []uint64{2, 3}
newList, _ = PMapUintUint64Err(plusOneUintUint64Err, []uint{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUintUint64 failed")
}
_, err = PMapUintUint64Err(plusOneUintUint64Err, []uint{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintUint64Err failed")
}
_, err = PMapUintUint64Err(plusOneUintUint64Err, []uint{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintUint64Err failed")
}
_, err = PMapUintUint64Err(plusOneUintUint64Err, []uint{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintUint64Err failed")
}
_, err = PMapUintUint64Err(plusOneUintUint64Err, []uint{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintUint64Err failed")
}
_, err = PMapUintUint64Err(plusOneUintUint64Err, []uint{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintUint64Err failed")
}
}
func TestPmapUintUint32Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []uint32{2, 3}
newList, _ := PMapUintUint32Err(plusOneUintUint32Err, []uint{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUintUint32 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUintUint32Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUintUint32Err failed")
}
r, _ = PMapUintUint32Err(nil, []uint{})
if len(r) > 0 {
t.Errorf("PMapUintUint32Err failed")
}
_, err := PMapUintUint32Err(plusOneUintUint32Err, []uint{1, 2, 3})
if err == nil {
t.Errorf("PMapUintUint32Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUintUint32Err(plusOneUintUint32Err, []uint{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUintUint32Err failed")
}
_, err = PMapUintUint32Err(plusOneUintUint32Err, []uint{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUintUint32Err failed")
}
_, err = PMapUintUint32Err(plusOneUintUint32Err, []uint{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUintUint32Err failed")
}
_, err = PMapUintUint32Err(plusOneUintUint32Err, []uint{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUintUint32Err failed")
}
expectedList = []uint32{2, 3}
newList, _ = PMapUintUint32Err(plusOneUintUint32Err, []uint{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUintUint32 failed")
}
_, err = PMapUintUint32Err(plusOneUintUint32Err, []uint{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintUint32Err failed")
}
_, err = PMapUintUint32Err(plusOneUintUint32Err, []uint{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintUint32Err failed")
}
_, err = PMapUintUint32Err(plusOneUintUint32Err, []uint{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintUint32Err failed")
}
_, err = PMapUintUint32Err(plusOneUintUint32Err, []uint{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintUint32Err failed")
}
_, err = PMapUintUint32Err(plusOneUintUint32Err, []uint{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintUint32Err failed")
}
}
func TestPmapUintUint16Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []uint16{2, 3}
newList, _ := PMapUintUint16Err(plusOneUintUint16Err, []uint{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUintUint16 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUintUint16Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUintUint16Err failed")
}
r, _ = PMapUintUint16Err(nil, []uint{})
if len(r) > 0 {
t.Errorf("PMapUintUint16Err failed")
}
_, err := PMapUintUint16Err(plusOneUintUint16Err, []uint{1, 2, 3})
if err == nil {
t.Errorf("PMapUintUint16Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUintUint16Err(plusOneUintUint16Err, []uint{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUintUint16Err failed")
}
_, err = PMapUintUint16Err(plusOneUintUint16Err, []uint{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUintUint16Err failed")
}
_, err = PMapUintUint16Err(plusOneUintUint16Err, []uint{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUintUint16Err failed")
}
_, err = PMapUintUint16Err(plusOneUintUint16Err, []uint{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUintUint16Err failed")
}
expectedList = []uint16{2, 3}
newList, _ = PMapUintUint16Err(plusOneUintUint16Err, []uint{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUintUint16 failed")
}
_, err = PMapUintUint16Err(plusOneUintUint16Err, []uint{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintUint16Err failed")
}
_, err = PMapUintUint16Err(plusOneUintUint16Err, []uint{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintUint16Err failed")
}
_, err = PMapUintUint16Err(plusOneUintUint16Err, []uint{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintUint16Err failed")
}
_, err = PMapUintUint16Err(plusOneUintUint16Err, []uint{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintUint16Err failed")
}
_, err = PMapUintUint16Err(plusOneUintUint16Err, []uint{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintUint16Err failed")
}
}
func TestPmapUintUint8Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []uint8{2, 3}
newList, _ := PMapUintUint8Err(plusOneUintUint8Err, []uint{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUintUint8 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUintUint8Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUintUint8Err failed")
}
r, _ = PMapUintUint8Err(nil, []uint{})
if len(r) > 0 {
t.Errorf("PMapUintUint8Err failed")
}
_, err := PMapUintUint8Err(plusOneUintUint8Err, []uint{1, 2, 3})
if err == nil {
t.Errorf("PMapUintUint8Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUintUint8Err(plusOneUintUint8Err, []uint{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUintUint8Err failed")
}
_, err = PMapUintUint8Err(plusOneUintUint8Err, []uint{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUintUint8Err failed")
}
_, err = PMapUintUint8Err(plusOneUintUint8Err, []uint{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUintUint8Err failed")
}
_, err = PMapUintUint8Err(plusOneUintUint8Err, []uint{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUintUint8Err failed")
}
expectedList = []uint8{2, 3}
newList, _ = PMapUintUint8Err(plusOneUintUint8Err, []uint{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUintUint8 failed")
}
_, err = PMapUintUint8Err(plusOneUintUint8Err, []uint{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintUint8Err failed")
}
_, err = PMapUintUint8Err(plusOneUintUint8Err, []uint{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintUint8Err failed")
}
_, err = PMapUintUint8Err(plusOneUintUint8Err, []uint{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintUint8Err failed")
}
_, err = PMapUintUint8Err(plusOneUintUint8Err, []uint{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintUint8Err failed")
}
_, err = PMapUintUint8Err(plusOneUintUint8Err, []uint{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintUint8Err failed")
}
}
func TestPmapUintStrErr(t *testing.T) {
// Test : someLogic
expectedList := []string{"10"}
newList, _ := PMapUintStrErr(someLogicUintStrErr, []uint{10})
if newList[0] != expectedList[0] {
t.Errorf("PMapUintStrErr failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUintStrErr(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUintStrErr failed")
}
r, _ = PMapUintStrErr(nil, []uint{})
if len(r) > 0 {
t.Errorf("PMapUintStrErr failed")
}
_, err := PMapUintStrErr(someLogicUintStrErr, []uint{10, 0})
if err == nil {
t.Errorf("PMapUintStrErr failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUintStrErr(someLogicUintStrErr, []uint{10, 10, 0}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUintStrErr failed")
}
_, err = PMapUintStrErr(someLogicUintStrErr, []uint{0, 0, 10}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUintStrErr failed")
}
_, err = PMapUintStrErr(someLogicUintStrErr, []uint{0, 10, 0}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUintStrErr failed")
}
_, err = PMapUintStrErr(someLogicUintStrErr, []uint{10, 10, 0}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUintStrErr failed")
}
expectedList = []string{"10", "10"}
newList, _ = PMapUintStrErr(someLogicUintStrErr, []uint{10, 10}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUintStr failed")
}
_, err = PMapUintStrErr(someLogicUintStrErr, []uint{10, 10, 0}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintStrErr failed")
}
_, err = PMapUintStrErr(someLogicUintStrErr, []uint{10, 10, 0}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintStrErr failed")
}
_, err = PMapUintStrErr(someLogicUintStrErr, []uint{0, 0, 10}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintStrErr failed")
}
_, err = PMapUintStrErr(someLogicUintStrErr, []uint{0, 10, 0}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintStrErr failed")
}
_, err = PMapUintStrErr(someLogicUintStrErr, []uint{10, 10, 0}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintStrErr failed")
}
}
func TestPmapUintBoolErr(t *testing.T) {
// Test : someLogic
expectedList := []bool{true, false}
newList, _ := PMapUintBoolErr(someLogicUintBoolErr, []uint{10, 0})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUintBoolErr failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUintBoolErr(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUintBoolErr failed")
}
r, _ = PMapUintBoolErr(nil, []uint{})
if len(r) > 0 {
t.Errorf("PMapUintBoolErr failed")
}
_, err := PMapUintBoolErr(someLogicUintBoolErr, []uint{10, 3, 3})
if err == nil {
t.Errorf("PMapUintBoolErr failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUintBoolErr(someLogicUintBoolErr, []uint{10, 10, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUintBoolErr failed")
}
_, err = PMapUintBoolErr(someLogicUintBoolErr, []uint{3, 3, 10}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUintBoolErr failed")
}
_, err = PMapUintBoolErr(someLogicUintBoolErr, []uint{3, 10, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUintBoolErr failed")
}
_, err = PMapUintBoolErr(someLogicUintBoolErr, []uint{10, 10, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUintBoolErr failed")
}
expectedList = []bool{true, true}
newList, _ = PMapUintBoolErr(someLogicUintBoolErr, []uint{10, 10}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUintBool failed")
}
_, err = PMapUintBoolErr(someLogicUintBoolErr, []uint{10, 10, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintBoolErr failed")
}
_, err = PMapUintBoolErr(someLogicUintBoolErr, []uint{10, 10, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintBoolErr failed")
}
_, err = PMapUintBoolErr(someLogicUintBoolErr, []uint{3, 3, 10}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintBoolErr failed")
}
_, err = PMapUintBoolErr(someLogicUintBoolErr, []uint{3, 10, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintBoolErr failed")
}
_, err = PMapUintBoolErr(someLogicUintBoolErr, []uint{10, 10, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintBoolErr failed")
}
}
func TestPmapUintFloat32Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []float32{2, 3}
newList, _ := PMapUintFloat32Err(plusOneUintFloat32Err, []uint{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUintFloat32 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUintFloat32Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUintFloat32Err failed")
}
r, _ = PMapUintFloat32Err(nil, []uint{})
if len(r) > 0 {
t.Errorf("PMapUintFloat32Err failed")
}
_, err := PMapUintFloat32Err(plusOneUintFloat32Err, []uint{1, 2, 3})
if err == nil {
t.Errorf("PMapUintFloat32Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUintFloat32Err(plusOneUintFloat32Err, []uint{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUintFloat32Err failed")
}
_, err = PMapUintFloat32Err(plusOneUintFloat32Err, []uint{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUintFloat32Err failed")
}
_, err = PMapUintFloat32Err(plusOneUintFloat32Err, []uint{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUintFloat32Err failed")
}
_, err = PMapUintFloat32Err(plusOneUintFloat32Err, []uint{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUintFloat32Err failed")
}
expectedList = []float32{2, 3}
newList, _ = PMapUintFloat32Err(plusOneUintFloat32Err, []uint{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUintFloat32 failed")
}
_, err = PMapUintFloat32Err(plusOneUintFloat32Err, []uint{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintFloat32Err failed")
}
_, err = PMapUintFloat32Err(plusOneUintFloat32Err, []uint{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintFloat32Err failed")
}
_, err = PMapUintFloat32Err(plusOneUintFloat32Err, []uint{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintFloat32Err failed")
}
_, err = PMapUintFloat32Err(plusOneUintFloat32Err, []uint{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintFloat32Err failed")
}
_, err = PMapUintFloat32Err(plusOneUintFloat32Err, []uint{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintFloat32Err failed")
}
}
func TestPmapUintFloat64Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []float64{2, 3}
newList, _ := PMapUintFloat64Err(plusOneUintFloat64Err, []uint{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUintFloat64 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUintFloat64Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUintFloat64Err failed")
}
r, _ = PMapUintFloat64Err(nil, []uint{})
if len(r) > 0 {
t.Errorf("PMapUintFloat64Err failed")
}
_, err := PMapUintFloat64Err(plusOneUintFloat64Err, []uint{1, 2, 3})
if err == nil {
t.Errorf("PMapUintFloat64Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUintFloat64Err(plusOneUintFloat64Err, []uint{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUintFloat64Err failed")
}
_, err = PMapUintFloat64Err(plusOneUintFloat64Err, []uint{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUintFloat64Err failed")
}
_, err = PMapUintFloat64Err(plusOneUintFloat64Err, []uint{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUintFloat64Err failed")
}
_, err = PMapUintFloat64Err(plusOneUintFloat64Err, []uint{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUintFloat64Err failed")
}
expectedList = []float64{2, 3}
newList, _ = PMapUintFloat64Err(plusOneUintFloat64Err, []uint{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUintFloat64 failed")
}
_, err = PMapUintFloat64Err(plusOneUintFloat64Err, []uint{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintFloat64Err failed")
}
_, err = PMapUintFloat64Err(plusOneUintFloat64Err, []uint{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintFloat64Err failed")
}
_, err = PMapUintFloat64Err(plusOneUintFloat64Err, []uint{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintFloat64Err failed")
}
_, err = PMapUintFloat64Err(plusOneUintFloat64Err, []uint{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintFloat64Err failed")
}
_, err = PMapUintFloat64Err(plusOneUintFloat64Err, []uint{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUintFloat64Err failed")
}
}
func TestPmapUint64IntErr(t *testing.T) {
// Test : add 1 to the list
expectedList := []int{2, 3}
newList, _ := PMapUint64IntErr(plusOneUint64IntErr, []uint64{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUint64Int failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUint64IntErr(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUint64IntErr failed")
}
r, _ = PMapUint64IntErr(nil, []uint64{})
if len(r) > 0 {
t.Errorf("PMapUint64IntErr failed")
}
_, err := PMapUint64IntErr(plusOneUint64IntErr, []uint64{1, 2, 3})
if err == nil {
t.Errorf("PMapUint64IntErr failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUint64IntErr(plusOneUint64IntErr, []uint64{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint64IntErr failed")
}
_, err = PMapUint64IntErr(plusOneUint64IntErr, []uint64{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUint64IntErr failed")
}
_, err = PMapUint64IntErr(plusOneUint64IntErr, []uint64{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint64IntErr failed")
}
_, err = PMapUint64IntErr(plusOneUint64IntErr, []uint64{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint64IntErr failed")
}
expectedList = []int{2, 3}
newList, _ = PMapUint64IntErr(plusOneUint64IntErr, []uint64{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUint64Int failed")
}
_, err = PMapUint64IntErr(plusOneUint64IntErr, []uint64{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64IntErr failed")
}
_, err = PMapUint64IntErr(plusOneUint64IntErr, []uint64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64IntErr failed")
}
_, err = PMapUint64IntErr(plusOneUint64IntErr, []uint64{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64IntErr failed")
}
_, err = PMapUint64IntErr(plusOneUint64IntErr, []uint64{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64IntErr failed")
}
_, err = PMapUint64IntErr(plusOneUint64IntErr, []uint64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64IntErr failed")
}
}
func TestPmapUint64Int64Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []int64{2, 3}
newList, _ := PMapUint64Int64Err(plusOneUint64Int64Err, []uint64{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUint64Int64 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUint64Int64Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUint64Int64Err failed")
}
r, _ = PMapUint64Int64Err(nil, []uint64{})
if len(r) > 0 {
t.Errorf("PMapUint64Int64Err failed")
}
_, err := PMapUint64Int64Err(plusOneUint64Int64Err, []uint64{1, 2, 3})
if err == nil {
t.Errorf("PMapUint64Int64Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUint64Int64Err(plusOneUint64Int64Err, []uint64{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint64Int64Err failed")
}
_, err = PMapUint64Int64Err(plusOneUint64Int64Err, []uint64{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUint64Int64Err failed")
}
_, err = PMapUint64Int64Err(plusOneUint64Int64Err, []uint64{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint64Int64Err failed")
}
_, err = PMapUint64Int64Err(plusOneUint64Int64Err, []uint64{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint64Int64Err failed")
}
expectedList = []int64{2, 3}
newList, _ = PMapUint64Int64Err(plusOneUint64Int64Err, []uint64{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUint64Int64 failed")
}
_, err = PMapUint64Int64Err(plusOneUint64Int64Err, []uint64{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64Int64Err failed")
}
_, err = PMapUint64Int64Err(plusOneUint64Int64Err, []uint64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64Int64Err failed")
}
_, err = PMapUint64Int64Err(plusOneUint64Int64Err, []uint64{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64Int64Err failed")
}
_, err = PMapUint64Int64Err(plusOneUint64Int64Err, []uint64{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64Int64Err failed")
}
_, err = PMapUint64Int64Err(plusOneUint64Int64Err, []uint64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64Int64Err failed")
}
}
func TestPmapUint64Int32Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []int32{2, 3}
newList, _ := PMapUint64Int32Err(plusOneUint64Int32Err, []uint64{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUint64Int32 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUint64Int32Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUint64Int32Err failed")
}
r, _ = PMapUint64Int32Err(nil, []uint64{})
if len(r) > 0 {
t.Errorf("PMapUint64Int32Err failed")
}
_, err := PMapUint64Int32Err(plusOneUint64Int32Err, []uint64{1, 2, 3})
if err == nil {
t.Errorf("PMapUint64Int32Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUint64Int32Err(plusOneUint64Int32Err, []uint64{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint64Int32Err failed")
}
_, err = PMapUint64Int32Err(plusOneUint64Int32Err, []uint64{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUint64Int32Err failed")
}
_, err = PMapUint64Int32Err(plusOneUint64Int32Err, []uint64{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint64Int32Err failed")
}
_, err = PMapUint64Int32Err(plusOneUint64Int32Err, []uint64{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint64Int32Err failed")
}
expectedList = []int32{2, 3}
newList, _ = PMapUint64Int32Err(plusOneUint64Int32Err, []uint64{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUint64Int32 failed")
}
_, err = PMapUint64Int32Err(plusOneUint64Int32Err, []uint64{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64Int32Err failed")
}
_, err = PMapUint64Int32Err(plusOneUint64Int32Err, []uint64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64Int32Err failed")
}
_, err = PMapUint64Int32Err(plusOneUint64Int32Err, []uint64{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64Int32Err failed")
}
_, err = PMapUint64Int32Err(plusOneUint64Int32Err, []uint64{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64Int32Err failed")
}
_, err = PMapUint64Int32Err(plusOneUint64Int32Err, []uint64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64Int32Err failed")
}
}
func TestPmapUint64Int16Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []int16{2, 3}
newList, _ := PMapUint64Int16Err(plusOneUint64Int16Err, []uint64{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUint64Int16 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUint64Int16Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUint64Int16Err failed")
}
r, _ = PMapUint64Int16Err(nil, []uint64{})
if len(r) > 0 {
t.Errorf("PMapUint64Int16Err failed")
}
_, err := PMapUint64Int16Err(plusOneUint64Int16Err, []uint64{1, 2, 3})
if err == nil {
t.Errorf("PMapUint64Int16Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUint64Int16Err(plusOneUint64Int16Err, []uint64{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint64Int16Err failed")
}
_, err = PMapUint64Int16Err(plusOneUint64Int16Err, []uint64{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUint64Int16Err failed")
}
_, err = PMapUint64Int16Err(plusOneUint64Int16Err, []uint64{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint64Int16Err failed")
}
_, err = PMapUint64Int16Err(plusOneUint64Int16Err, []uint64{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint64Int16Err failed")
}
expectedList = []int16{2, 3}
newList, _ = PMapUint64Int16Err(plusOneUint64Int16Err, []uint64{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUint64Int16 failed")
}
_, err = PMapUint64Int16Err(plusOneUint64Int16Err, []uint64{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64Int16Err failed")
}
_, err = PMapUint64Int16Err(plusOneUint64Int16Err, []uint64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64Int16Err failed")
}
_, err = PMapUint64Int16Err(plusOneUint64Int16Err, []uint64{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64Int16Err failed")
}
_, err = PMapUint64Int16Err(plusOneUint64Int16Err, []uint64{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64Int16Err failed")
}
_, err = PMapUint64Int16Err(plusOneUint64Int16Err, []uint64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64Int16Err failed")
}
}
func TestPmapUint64Int8Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []int8{2, 3}
newList, _ := PMapUint64Int8Err(plusOneUint64Int8Err, []uint64{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUint64Int8 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUint64Int8Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUint64Int8Err failed")
}
r, _ = PMapUint64Int8Err(nil, []uint64{})
if len(r) > 0 {
t.Errorf("PMapUint64Int8Err failed")
}
_, err := PMapUint64Int8Err(plusOneUint64Int8Err, []uint64{1, 2, 3})
if err == nil {
t.Errorf("PMapUint64Int8Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUint64Int8Err(plusOneUint64Int8Err, []uint64{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint64Int8Err failed")
}
_, err = PMapUint64Int8Err(plusOneUint64Int8Err, []uint64{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUint64Int8Err failed")
}
_, err = PMapUint64Int8Err(plusOneUint64Int8Err, []uint64{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint64Int8Err failed")
}
_, err = PMapUint64Int8Err(plusOneUint64Int8Err, []uint64{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint64Int8Err failed")
}
expectedList = []int8{2, 3}
newList, _ = PMapUint64Int8Err(plusOneUint64Int8Err, []uint64{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUint64Int8 failed")
}
_, err = PMapUint64Int8Err(plusOneUint64Int8Err, []uint64{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64Int8Err failed")
}
_, err = PMapUint64Int8Err(plusOneUint64Int8Err, []uint64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64Int8Err failed")
}
_, err = PMapUint64Int8Err(plusOneUint64Int8Err, []uint64{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64Int8Err failed")
}
_, err = PMapUint64Int8Err(plusOneUint64Int8Err, []uint64{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64Int8Err failed")
}
_, err = PMapUint64Int8Err(plusOneUint64Int8Err, []uint64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64Int8Err failed")
}
}
func TestPmapUint64UintErr(t *testing.T) {
// Test : add 1 to the list
expectedList := []uint{2, 3}
newList, _ := PMapUint64UintErr(plusOneUint64UintErr, []uint64{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUint64Uint failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUint64UintErr(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUint64UintErr failed")
}
r, _ = PMapUint64UintErr(nil, []uint64{})
if len(r) > 0 {
t.Errorf("PMapUint64UintErr failed")
}
_, err := PMapUint64UintErr(plusOneUint64UintErr, []uint64{1, 2, 3})
if err == nil {
t.Errorf("PMapUint64UintErr failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUint64UintErr(plusOneUint64UintErr, []uint64{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint64UintErr failed")
}
_, err = PMapUint64UintErr(plusOneUint64UintErr, []uint64{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUint64UintErr failed")
}
_, err = PMapUint64UintErr(plusOneUint64UintErr, []uint64{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint64UintErr failed")
}
_, err = PMapUint64UintErr(plusOneUint64UintErr, []uint64{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint64UintErr failed")
}
expectedList = []uint{2, 3}
newList, _ = PMapUint64UintErr(plusOneUint64UintErr, []uint64{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUint64Uint failed")
}
_, err = PMapUint64UintErr(plusOneUint64UintErr, []uint64{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64UintErr failed")
}
_, err = PMapUint64UintErr(plusOneUint64UintErr, []uint64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64UintErr failed")
}
_, err = PMapUint64UintErr(plusOneUint64UintErr, []uint64{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64UintErr failed")
}
_, err = PMapUint64UintErr(plusOneUint64UintErr, []uint64{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64UintErr failed")
}
_, err = PMapUint64UintErr(plusOneUint64UintErr, []uint64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64UintErr failed")
}
}
func TestPmapUint64Uint32Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []uint32{2, 3}
newList, _ := PMapUint64Uint32Err(plusOneUint64Uint32Err, []uint64{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUint64Uint32 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUint64Uint32Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUint64Uint32Err failed")
}
r, _ = PMapUint64Uint32Err(nil, []uint64{})
if len(r) > 0 {
t.Errorf("PMapUint64Uint32Err failed")
}
_, err := PMapUint64Uint32Err(plusOneUint64Uint32Err, []uint64{1, 2, 3})
if err == nil {
t.Errorf("PMapUint64Uint32Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUint64Uint32Err(plusOneUint64Uint32Err, []uint64{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint64Uint32Err failed")
}
_, err = PMapUint64Uint32Err(plusOneUint64Uint32Err, []uint64{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUint64Uint32Err failed")
}
_, err = PMapUint64Uint32Err(plusOneUint64Uint32Err, []uint64{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint64Uint32Err failed")
}
_, err = PMapUint64Uint32Err(plusOneUint64Uint32Err, []uint64{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint64Uint32Err failed")
}
expectedList = []uint32{2, 3}
newList, _ = PMapUint64Uint32Err(plusOneUint64Uint32Err, []uint64{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUint64Uint32 failed")
}
_, err = PMapUint64Uint32Err(plusOneUint64Uint32Err, []uint64{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64Uint32Err failed")
}
_, err = PMapUint64Uint32Err(plusOneUint64Uint32Err, []uint64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64Uint32Err failed")
}
_, err = PMapUint64Uint32Err(plusOneUint64Uint32Err, []uint64{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64Uint32Err failed")
}
_, err = PMapUint64Uint32Err(plusOneUint64Uint32Err, []uint64{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64Uint32Err failed")
}
_, err = PMapUint64Uint32Err(plusOneUint64Uint32Err, []uint64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64Uint32Err failed")
}
}
func TestPmapUint64Uint16Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []uint16{2, 3}
newList, _ := PMapUint64Uint16Err(plusOneUint64Uint16Err, []uint64{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUint64Uint16 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUint64Uint16Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUint64Uint16Err failed")
}
r, _ = PMapUint64Uint16Err(nil, []uint64{})
if len(r) > 0 {
t.Errorf("PMapUint64Uint16Err failed")
}
_, err := PMapUint64Uint16Err(plusOneUint64Uint16Err, []uint64{1, 2, 3})
if err == nil {
t.Errorf("PMapUint64Uint16Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUint64Uint16Err(plusOneUint64Uint16Err, []uint64{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint64Uint16Err failed")
}
_, err = PMapUint64Uint16Err(plusOneUint64Uint16Err, []uint64{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUint64Uint16Err failed")
}
_, err = PMapUint64Uint16Err(plusOneUint64Uint16Err, []uint64{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint64Uint16Err failed")
}
_, err = PMapUint64Uint16Err(plusOneUint64Uint16Err, []uint64{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint64Uint16Err failed")
}
expectedList = []uint16{2, 3}
newList, _ = PMapUint64Uint16Err(plusOneUint64Uint16Err, []uint64{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUint64Uint16 failed")
}
_, err = PMapUint64Uint16Err(plusOneUint64Uint16Err, []uint64{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64Uint16Err failed")
}
_, err = PMapUint64Uint16Err(plusOneUint64Uint16Err, []uint64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64Uint16Err failed")
}
_, err = PMapUint64Uint16Err(plusOneUint64Uint16Err, []uint64{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64Uint16Err failed")
}
_, err = PMapUint64Uint16Err(plusOneUint64Uint16Err, []uint64{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64Uint16Err failed")
}
_, err = PMapUint64Uint16Err(plusOneUint64Uint16Err, []uint64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64Uint16Err failed")
}
}
func TestPmapUint64Uint8Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []uint8{2, 3}
newList, _ := PMapUint64Uint8Err(plusOneUint64Uint8Err, []uint64{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUint64Uint8 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUint64Uint8Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUint64Uint8Err failed")
}
r, _ = PMapUint64Uint8Err(nil, []uint64{})
if len(r) > 0 {
t.Errorf("PMapUint64Uint8Err failed")
}
_, err := PMapUint64Uint8Err(plusOneUint64Uint8Err, []uint64{1, 2, 3})
if err == nil {
t.Errorf("PMapUint64Uint8Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUint64Uint8Err(plusOneUint64Uint8Err, []uint64{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint64Uint8Err failed")
}
_, err = PMapUint64Uint8Err(plusOneUint64Uint8Err, []uint64{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUint64Uint8Err failed")
}
_, err = PMapUint64Uint8Err(plusOneUint64Uint8Err, []uint64{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint64Uint8Err failed")
}
_, err = PMapUint64Uint8Err(plusOneUint64Uint8Err, []uint64{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint64Uint8Err failed")
}
expectedList = []uint8{2, 3}
newList, _ = PMapUint64Uint8Err(plusOneUint64Uint8Err, []uint64{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUint64Uint8 failed")
}
_, err = PMapUint64Uint8Err(plusOneUint64Uint8Err, []uint64{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64Uint8Err failed")
}
_, err = PMapUint64Uint8Err(plusOneUint64Uint8Err, []uint64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64Uint8Err failed")
}
_, err = PMapUint64Uint8Err(plusOneUint64Uint8Err, []uint64{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64Uint8Err failed")
}
_, err = PMapUint64Uint8Err(plusOneUint64Uint8Err, []uint64{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64Uint8Err failed")
}
_, err = PMapUint64Uint8Err(plusOneUint64Uint8Err, []uint64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64Uint8Err failed")
}
}
func TestPmapUint64StrErr(t *testing.T) {
// Test : someLogic
expectedList := []string{"10"}
newList, _ := PMapUint64StrErr(someLogicUint64StrErr, []uint64{10})
if newList[0] != expectedList[0] {
t.Errorf("PMapUint64StrErr failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUint64StrErr(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUint64StrErr failed")
}
r, _ = PMapUint64StrErr(nil, []uint64{})
if len(r) > 0 {
t.Errorf("PMapUint64StrErr failed")
}
_, err := PMapUint64StrErr(someLogicUint64StrErr, []uint64{10, 0})
if err == nil {
t.Errorf("PMapUint64StrErr failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUint64StrErr(someLogicUint64StrErr, []uint64{10, 10, 0}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint64StrErr failed")
}
_, err = PMapUint64StrErr(someLogicUint64StrErr, []uint64{0, 0, 10}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUint64StrErr failed")
}
_, err = PMapUint64StrErr(someLogicUint64StrErr, []uint64{0, 10, 0}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint64StrErr failed")
}
_, err = PMapUint64StrErr(someLogicUint64StrErr, []uint64{10, 10, 0}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint64StrErr failed")
}
expectedList = []string{"10", "10"}
newList, _ = PMapUint64StrErr(someLogicUint64StrErr, []uint64{10, 10}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUint64Str failed")
}
_, err = PMapUint64StrErr(someLogicUint64StrErr, []uint64{10, 10, 0}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64StrErr failed")
}
_, err = PMapUint64StrErr(someLogicUint64StrErr, []uint64{10, 10, 0}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64StrErr failed")
}
_, err = PMapUint64StrErr(someLogicUint64StrErr, []uint64{0, 0, 10}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64StrErr failed")
}
_, err = PMapUint64StrErr(someLogicUint64StrErr, []uint64{0, 10, 0}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64StrErr failed")
}
_, err = PMapUint64StrErr(someLogicUint64StrErr, []uint64{10, 10, 0}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64StrErr failed")
}
}
func TestPmapUint64BoolErr(t *testing.T) {
// Test : someLogic
expectedList := []bool{true, false}
newList, _ := PMapUint64BoolErr(someLogicUint64BoolErr, []uint64{10, 0})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUint64BoolErr failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUint64BoolErr(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUint64BoolErr failed")
}
r, _ = PMapUint64BoolErr(nil, []uint64{})
if len(r) > 0 {
t.Errorf("PMapUint64BoolErr failed")
}
_, err := PMapUint64BoolErr(someLogicUint64BoolErr, []uint64{10, 3, 3})
if err == nil {
t.Errorf("PMapUint64BoolErr failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUint64BoolErr(someLogicUint64BoolErr, []uint64{10, 10, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint64BoolErr failed")
}
_, err = PMapUint64BoolErr(someLogicUint64BoolErr, []uint64{3, 3, 10}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUint64BoolErr failed")
}
_, err = PMapUint64BoolErr(someLogicUint64BoolErr, []uint64{3, 10, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint64BoolErr failed")
}
_, err = PMapUint64BoolErr(someLogicUint64BoolErr, []uint64{10, 10, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint64BoolErr failed")
}
expectedList = []bool{true, true}
newList, _ = PMapUint64BoolErr(someLogicUint64BoolErr, []uint64{10, 10}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUint64Bool failed")
}
_, err = PMapUint64BoolErr(someLogicUint64BoolErr, []uint64{10, 10, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64BoolErr failed")
}
_, err = PMapUint64BoolErr(someLogicUint64BoolErr, []uint64{10, 10, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64BoolErr failed")
}
_, err = PMapUint64BoolErr(someLogicUint64BoolErr, []uint64{3, 3, 10}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64BoolErr failed")
}
_, err = PMapUint64BoolErr(someLogicUint64BoolErr, []uint64{3, 10, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64BoolErr failed")
}
_, err = PMapUint64BoolErr(someLogicUint64BoolErr, []uint64{10, 10, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64BoolErr failed")
}
}
func TestPmapUint64Float32Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []float32{2, 3}
newList, _ := PMapUint64Float32Err(plusOneUint64Float32Err, []uint64{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUint64Float32 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUint64Float32Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUint64Float32Err failed")
}
r, _ = PMapUint64Float32Err(nil, []uint64{})
if len(r) > 0 {
t.Errorf("PMapUint64Float32Err failed")
}
_, err := PMapUint64Float32Err(plusOneUint64Float32Err, []uint64{1, 2, 3})
if err == nil {
t.Errorf("PMapUint64Float32Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUint64Float32Err(plusOneUint64Float32Err, []uint64{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint64Float32Err failed")
}
_, err = PMapUint64Float32Err(plusOneUint64Float32Err, []uint64{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUint64Float32Err failed")
}
_, err = PMapUint64Float32Err(plusOneUint64Float32Err, []uint64{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint64Float32Err failed")
}
_, err = PMapUint64Float32Err(plusOneUint64Float32Err, []uint64{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint64Float32Err failed")
}
expectedList = []float32{2, 3}
newList, _ = PMapUint64Float32Err(plusOneUint64Float32Err, []uint64{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUint64Float32 failed")
}
_, err = PMapUint64Float32Err(plusOneUint64Float32Err, []uint64{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64Float32Err failed")
}
_, err = PMapUint64Float32Err(plusOneUint64Float32Err, []uint64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64Float32Err failed")
}
_, err = PMapUint64Float32Err(plusOneUint64Float32Err, []uint64{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64Float32Err failed")
}
_, err = PMapUint64Float32Err(plusOneUint64Float32Err, []uint64{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64Float32Err failed")
}
_, err = PMapUint64Float32Err(plusOneUint64Float32Err, []uint64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64Float32Err failed")
}
}
func TestPmapUint64Float64Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []float64{2, 3}
newList, _ := PMapUint64Float64Err(plusOneUint64Float64Err, []uint64{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUint64Float64 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUint64Float64Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUint64Float64Err failed")
}
r, _ = PMapUint64Float64Err(nil, []uint64{})
if len(r) > 0 {
t.Errorf("PMapUint64Float64Err failed")
}
_, err := PMapUint64Float64Err(plusOneUint64Float64Err, []uint64{1, 2, 3})
if err == nil {
t.Errorf("PMapUint64Float64Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUint64Float64Err(plusOneUint64Float64Err, []uint64{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint64Float64Err failed")
}
_, err = PMapUint64Float64Err(plusOneUint64Float64Err, []uint64{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUint64Float64Err failed")
}
_, err = PMapUint64Float64Err(plusOneUint64Float64Err, []uint64{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint64Float64Err failed")
}
_, err = PMapUint64Float64Err(plusOneUint64Float64Err, []uint64{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint64Float64Err failed")
}
expectedList = []float64{2, 3}
newList, _ = PMapUint64Float64Err(plusOneUint64Float64Err, []uint64{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUint64Float64 failed")
}
_, err = PMapUint64Float64Err(plusOneUint64Float64Err, []uint64{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64Float64Err failed")
}
_, err = PMapUint64Float64Err(plusOneUint64Float64Err, []uint64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64Float64Err failed")
}
_, err = PMapUint64Float64Err(plusOneUint64Float64Err, []uint64{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64Float64Err failed")
}
_, err = PMapUint64Float64Err(plusOneUint64Float64Err, []uint64{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64Float64Err failed")
}
_, err = PMapUint64Float64Err(plusOneUint64Float64Err, []uint64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint64Float64Err failed")
}
}
func TestPmapUint32IntErr(t *testing.T) {
// Test : add 1 to the list
expectedList := []int{2, 3}
newList, _ := PMapUint32IntErr(plusOneUint32IntErr, []uint32{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUint32Int failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUint32IntErr(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUint32IntErr failed")
}
r, _ = PMapUint32IntErr(nil, []uint32{})
if len(r) > 0 {
t.Errorf("PMapUint32IntErr failed")
}
_, err := PMapUint32IntErr(plusOneUint32IntErr, []uint32{1, 2, 3})
if err == nil {
t.Errorf("PMapUint32IntErr failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUint32IntErr(plusOneUint32IntErr, []uint32{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint32IntErr failed")
}
_, err = PMapUint32IntErr(plusOneUint32IntErr, []uint32{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUint32IntErr failed")
}
_, err = PMapUint32IntErr(plusOneUint32IntErr, []uint32{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint32IntErr failed")
}
_, err = PMapUint32IntErr(plusOneUint32IntErr, []uint32{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint32IntErr failed")
}
expectedList = []int{2, 3}
newList, _ = PMapUint32IntErr(plusOneUint32IntErr, []uint32{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUint32Int failed")
}
_, err = PMapUint32IntErr(plusOneUint32IntErr, []uint32{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32IntErr failed")
}
_, err = PMapUint32IntErr(plusOneUint32IntErr, []uint32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32IntErr failed")
}
_, err = PMapUint32IntErr(plusOneUint32IntErr, []uint32{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32IntErr failed")
}
_, err = PMapUint32IntErr(plusOneUint32IntErr, []uint32{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32IntErr failed")
}
_, err = PMapUint32IntErr(plusOneUint32IntErr, []uint32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32IntErr failed")
}
}
func TestPmapUint32Int64Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []int64{2, 3}
newList, _ := PMapUint32Int64Err(plusOneUint32Int64Err, []uint32{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUint32Int64 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUint32Int64Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUint32Int64Err failed")
}
r, _ = PMapUint32Int64Err(nil, []uint32{})
if len(r) > 0 {
t.Errorf("PMapUint32Int64Err failed")
}
_, err := PMapUint32Int64Err(plusOneUint32Int64Err, []uint32{1, 2, 3})
if err == nil {
t.Errorf("PMapUint32Int64Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUint32Int64Err(plusOneUint32Int64Err, []uint32{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint32Int64Err failed")
}
_, err = PMapUint32Int64Err(plusOneUint32Int64Err, []uint32{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUint32Int64Err failed")
}
_, err = PMapUint32Int64Err(plusOneUint32Int64Err, []uint32{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint32Int64Err failed")
}
_, err = PMapUint32Int64Err(plusOneUint32Int64Err, []uint32{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint32Int64Err failed")
}
expectedList = []int64{2, 3}
newList, _ = PMapUint32Int64Err(plusOneUint32Int64Err, []uint32{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUint32Int64 failed")
}
_, err = PMapUint32Int64Err(plusOneUint32Int64Err, []uint32{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32Int64Err failed")
}
_, err = PMapUint32Int64Err(plusOneUint32Int64Err, []uint32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32Int64Err failed")
}
_, err = PMapUint32Int64Err(plusOneUint32Int64Err, []uint32{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32Int64Err failed")
}
_, err = PMapUint32Int64Err(plusOneUint32Int64Err, []uint32{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32Int64Err failed")
}
_, err = PMapUint32Int64Err(plusOneUint32Int64Err, []uint32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32Int64Err failed")
}
}
func TestPmapUint32Int32Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []int32{2, 3}
newList, _ := PMapUint32Int32Err(plusOneUint32Int32Err, []uint32{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUint32Int32 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUint32Int32Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUint32Int32Err failed")
}
r, _ = PMapUint32Int32Err(nil, []uint32{})
if len(r) > 0 {
t.Errorf("PMapUint32Int32Err failed")
}
_, err := PMapUint32Int32Err(plusOneUint32Int32Err, []uint32{1, 2, 3})
if err == nil {
t.Errorf("PMapUint32Int32Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUint32Int32Err(plusOneUint32Int32Err, []uint32{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint32Int32Err failed")
}
_, err = PMapUint32Int32Err(plusOneUint32Int32Err, []uint32{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUint32Int32Err failed")
}
_, err = PMapUint32Int32Err(plusOneUint32Int32Err, []uint32{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint32Int32Err failed")
}
_, err = PMapUint32Int32Err(plusOneUint32Int32Err, []uint32{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint32Int32Err failed")
}
expectedList = []int32{2, 3}
newList, _ = PMapUint32Int32Err(plusOneUint32Int32Err, []uint32{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUint32Int32 failed")
}
_, err = PMapUint32Int32Err(plusOneUint32Int32Err, []uint32{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32Int32Err failed")
}
_, err = PMapUint32Int32Err(plusOneUint32Int32Err, []uint32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32Int32Err failed")
}
_, err = PMapUint32Int32Err(plusOneUint32Int32Err, []uint32{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32Int32Err failed")
}
_, err = PMapUint32Int32Err(plusOneUint32Int32Err, []uint32{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32Int32Err failed")
}
_, err = PMapUint32Int32Err(plusOneUint32Int32Err, []uint32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32Int32Err failed")
}
}
func TestPmapUint32Int16Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []int16{2, 3}
newList, _ := PMapUint32Int16Err(plusOneUint32Int16Err, []uint32{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUint32Int16 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUint32Int16Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUint32Int16Err failed")
}
r, _ = PMapUint32Int16Err(nil, []uint32{})
if len(r) > 0 {
t.Errorf("PMapUint32Int16Err failed")
}
_, err := PMapUint32Int16Err(plusOneUint32Int16Err, []uint32{1, 2, 3})
if err == nil {
t.Errorf("PMapUint32Int16Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUint32Int16Err(plusOneUint32Int16Err, []uint32{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint32Int16Err failed")
}
_, err = PMapUint32Int16Err(plusOneUint32Int16Err, []uint32{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUint32Int16Err failed")
}
_, err = PMapUint32Int16Err(plusOneUint32Int16Err, []uint32{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint32Int16Err failed")
}
_, err = PMapUint32Int16Err(plusOneUint32Int16Err, []uint32{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint32Int16Err failed")
}
expectedList = []int16{2, 3}
newList, _ = PMapUint32Int16Err(plusOneUint32Int16Err, []uint32{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUint32Int16 failed")
}
_, err = PMapUint32Int16Err(plusOneUint32Int16Err, []uint32{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32Int16Err failed")
}
_, err = PMapUint32Int16Err(plusOneUint32Int16Err, []uint32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32Int16Err failed")
}
_, err = PMapUint32Int16Err(plusOneUint32Int16Err, []uint32{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32Int16Err failed")
}
_, err = PMapUint32Int16Err(plusOneUint32Int16Err, []uint32{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32Int16Err failed")
}
_, err = PMapUint32Int16Err(plusOneUint32Int16Err, []uint32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32Int16Err failed")
}
}
func TestPmapUint32Int8Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []int8{2, 3}
newList, _ := PMapUint32Int8Err(plusOneUint32Int8Err, []uint32{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUint32Int8 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUint32Int8Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUint32Int8Err failed")
}
r, _ = PMapUint32Int8Err(nil, []uint32{})
if len(r) > 0 {
t.Errorf("PMapUint32Int8Err failed")
}
_, err := PMapUint32Int8Err(plusOneUint32Int8Err, []uint32{1, 2, 3})
if err == nil {
t.Errorf("PMapUint32Int8Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUint32Int8Err(plusOneUint32Int8Err, []uint32{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint32Int8Err failed")
}
_, err = PMapUint32Int8Err(plusOneUint32Int8Err, []uint32{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUint32Int8Err failed")
}
_, err = PMapUint32Int8Err(plusOneUint32Int8Err, []uint32{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint32Int8Err failed")
}
_, err = PMapUint32Int8Err(plusOneUint32Int8Err, []uint32{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint32Int8Err failed")
}
expectedList = []int8{2, 3}
newList, _ = PMapUint32Int8Err(plusOneUint32Int8Err, []uint32{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUint32Int8 failed")
}
_, err = PMapUint32Int8Err(plusOneUint32Int8Err, []uint32{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32Int8Err failed")
}
_, err = PMapUint32Int8Err(plusOneUint32Int8Err, []uint32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32Int8Err failed")
}
_, err = PMapUint32Int8Err(plusOneUint32Int8Err, []uint32{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32Int8Err failed")
}
_, err = PMapUint32Int8Err(plusOneUint32Int8Err, []uint32{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32Int8Err failed")
}
_, err = PMapUint32Int8Err(plusOneUint32Int8Err, []uint32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32Int8Err failed")
}
}
func TestPmapUint32UintErr(t *testing.T) {
// Test : add 1 to the list
expectedList := []uint{2, 3}
newList, _ := PMapUint32UintErr(plusOneUint32UintErr, []uint32{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUint32Uint failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUint32UintErr(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUint32UintErr failed")
}
r, _ = PMapUint32UintErr(nil, []uint32{})
if len(r) > 0 {
t.Errorf("PMapUint32UintErr failed")
}
_, err := PMapUint32UintErr(plusOneUint32UintErr, []uint32{1, 2, 3})
if err == nil {
t.Errorf("PMapUint32UintErr failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUint32UintErr(plusOneUint32UintErr, []uint32{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint32UintErr failed")
}
_, err = PMapUint32UintErr(plusOneUint32UintErr, []uint32{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUint32UintErr failed")
}
_, err = PMapUint32UintErr(plusOneUint32UintErr, []uint32{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint32UintErr failed")
}
_, err = PMapUint32UintErr(plusOneUint32UintErr, []uint32{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint32UintErr failed")
}
expectedList = []uint{2, 3}
newList, _ = PMapUint32UintErr(plusOneUint32UintErr, []uint32{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUint32Uint failed")
}
_, err = PMapUint32UintErr(plusOneUint32UintErr, []uint32{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32UintErr failed")
}
_, err = PMapUint32UintErr(plusOneUint32UintErr, []uint32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32UintErr failed")
}
_, err = PMapUint32UintErr(plusOneUint32UintErr, []uint32{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32UintErr failed")
}
_, err = PMapUint32UintErr(plusOneUint32UintErr, []uint32{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32UintErr failed")
}
_, err = PMapUint32UintErr(plusOneUint32UintErr, []uint32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32UintErr failed")
}
}
func TestPmapUint32Uint64Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []uint64{2, 3}
newList, _ := PMapUint32Uint64Err(plusOneUint32Uint64Err, []uint32{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUint32Uint64 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUint32Uint64Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUint32Uint64Err failed")
}
r, _ = PMapUint32Uint64Err(nil, []uint32{})
if len(r) > 0 {
t.Errorf("PMapUint32Uint64Err failed")
}
_, err := PMapUint32Uint64Err(plusOneUint32Uint64Err, []uint32{1, 2, 3})
if err == nil {
t.Errorf("PMapUint32Uint64Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUint32Uint64Err(plusOneUint32Uint64Err, []uint32{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint32Uint64Err failed")
}
_, err = PMapUint32Uint64Err(plusOneUint32Uint64Err, []uint32{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUint32Uint64Err failed")
}
_, err = PMapUint32Uint64Err(plusOneUint32Uint64Err, []uint32{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint32Uint64Err failed")
}
_, err = PMapUint32Uint64Err(plusOneUint32Uint64Err, []uint32{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint32Uint64Err failed")
}
expectedList = []uint64{2, 3}
newList, _ = PMapUint32Uint64Err(plusOneUint32Uint64Err, []uint32{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUint32Uint64 failed")
}
_, err = PMapUint32Uint64Err(plusOneUint32Uint64Err, []uint32{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32Uint64Err failed")
}
_, err = PMapUint32Uint64Err(plusOneUint32Uint64Err, []uint32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32Uint64Err failed")
}
_, err = PMapUint32Uint64Err(plusOneUint32Uint64Err, []uint32{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32Uint64Err failed")
}
_, err = PMapUint32Uint64Err(plusOneUint32Uint64Err, []uint32{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32Uint64Err failed")
}
_, err = PMapUint32Uint64Err(plusOneUint32Uint64Err, []uint32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32Uint64Err failed")
}
}
func TestPmapUint32Uint16Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []uint16{2, 3}
newList, _ := PMapUint32Uint16Err(plusOneUint32Uint16Err, []uint32{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUint32Uint16 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUint32Uint16Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUint32Uint16Err failed")
}
r, _ = PMapUint32Uint16Err(nil, []uint32{})
if len(r) > 0 {
t.Errorf("PMapUint32Uint16Err failed")
}
_, err := PMapUint32Uint16Err(plusOneUint32Uint16Err, []uint32{1, 2, 3})
if err == nil {
t.Errorf("PMapUint32Uint16Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUint32Uint16Err(plusOneUint32Uint16Err, []uint32{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint32Uint16Err failed")
}
_, err = PMapUint32Uint16Err(plusOneUint32Uint16Err, []uint32{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUint32Uint16Err failed")
}
_, err = PMapUint32Uint16Err(plusOneUint32Uint16Err, []uint32{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint32Uint16Err failed")
}
_, err = PMapUint32Uint16Err(plusOneUint32Uint16Err, []uint32{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint32Uint16Err failed")
}
expectedList = []uint16{2, 3}
newList, _ = PMapUint32Uint16Err(plusOneUint32Uint16Err, []uint32{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUint32Uint16 failed")
}
_, err = PMapUint32Uint16Err(plusOneUint32Uint16Err, []uint32{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32Uint16Err failed")
}
_, err = PMapUint32Uint16Err(plusOneUint32Uint16Err, []uint32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32Uint16Err failed")
}
_, err = PMapUint32Uint16Err(plusOneUint32Uint16Err, []uint32{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32Uint16Err failed")
}
_, err = PMapUint32Uint16Err(plusOneUint32Uint16Err, []uint32{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32Uint16Err failed")
}
_, err = PMapUint32Uint16Err(plusOneUint32Uint16Err, []uint32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32Uint16Err failed")
}
}
func TestPmapUint32Uint8Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []uint8{2, 3}
newList, _ := PMapUint32Uint8Err(plusOneUint32Uint8Err, []uint32{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUint32Uint8 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUint32Uint8Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUint32Uint8Err failed")
}
r, _ = PMapUint32Uint8Err(nil, []uint32{})
if len(r) > 0 {
t.Errorf("PMapUint32Uint8Err failed")
}
_, err := PMapUint32Uint8Err(plusOneUint32Uint8Err, []uint32{1, 2, 3})
if err == nil {
t.Errorf("PMapUint32Uint8Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUint32Uint8Err(plusOneUint32Uint8Err, []uint32{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint32Uint8Err failed")
}
_, err = PMapUint32Uint8Err(plusOneUint32Uint8Err, []uint32{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUint32Uint8Err failed")
}
_, err = PMapUint32Uint8Err(plusOneUint32Uint8Err, []uint32{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint32Uint8Err failed")
}
_, err = PMapUint32Uint8Err(plusOneUint32Uint8Err, []uint32{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint32Uint8Err failed")
}
expectedList = []uint8{2, 3}
newList, _ = PMapUint32Uint8Err(plusOneUint32Uint8Err, []uint32{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUint32Uint8 failed")
}
_, err = PMapUint32Uint8Err(plusOneUint32Uint8Err, []uint32{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32Uint8Err failed")
}
_, err = PMapUint32Uint8Err(plusOneUint32Uint8Err, []uint32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32Uint8Err failed")
}
_, err = PMapUint32Uint8Err(plusOneUint32Uint8Err, []uint32{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32Uint8Err failed")
}
_, err = PMapUint32Uint8Err(plusOneUint32Uint8Err, []uint32{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32Uint8Err failed")
}
_, err = PMapUint32Uint8Err(plusOneUint32Uint8Err, []uint32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32Uint8Err failed")
}
}
func TestPmapUint32StrErr(t *testing.T) {
// Test : someLogic
expectedList := []string{"10"}
newList, _ := PMapUint32StrErr(someLogicUint32StrErr, []uint32{10})
if newList[0] != expectedList[0] {
t.Errorf("PMapUint32StrErr failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUint32StrErr(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUint32StrErr failed")
}
r, _ = PMapUint32StrErr(nil, []uint32{})
if len(r) > 0 {
t.Errorf("PMapUint32StrErr failed")
}
_, err := PMapUint32StrErr(someLogicUint32StrErr, []uint32{10, 0})
if err == nil {
t.Errorf("PMapUint32StrErr failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUint32StrErr(someLogicUint32StrErr, []uint32{10, 10, 0}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint32StrErr failed")
}
_, err = PMapUint32StrErr(someLogicUint32StrErr, []uint32{0, 0, 10}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUint32StrErr failed")
}
_, err = PMapUint32StrErr(someLogicUint32StrErr, []uint32{0, 10, 0}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint32StrErr failed")
}
_, err = PMapUint32StrErr(someLogicUint32StrErr, []uint32{10, 10, 0}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint32StrErr failed")
}
expectedList = []string{"10", "10"}
newList, _ = PMapUint32StrErr(someLogicUint32StrErr, []uint32{10, 10}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUint32Str failed")
}
_, err = PMapUint32StrErr(someLogicUint32StrErr, []uint32{10, 10, 0}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32StrErr failed")
}
_, err = PMapUint32StrErr(someLogicUint32StrErr, []uint32{10, 10, 0}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32StrErr failed")
}
_, err = PMapUint32StrErr(someLogicUint32StrErr, []uint32{0, 0, 10}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32StrErr failed")
}
_, err = PMapUint32StrErr(someLogicUint32StrErr, []uint32{0, 10, 0}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32StrErr failed")
}
_, err = PMapUint32StrErr(someLogicUint32StrErr, []uint32{10, 10, 0}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32StrErr failed")
}
}
func TestPmapUint32BoolErr(t *testing.T) {
// Test : someLogic
expectedList := []bool{true, false}
newList, _ := PMapUint32BoolErr(someLogicUint32BoolErr, []uint32{10, 0})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUint32BoolErr failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUint32BoolErr(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUint32BoolErr failed")
}
r, _ = PMapUint32BoolErr(nil, []uint32{})
if len(r) > 0 {
t.Errorf("PMapUint32BoolErr failed")
}
_, err := PMapUint32BoolErr(someLogicUint32BoolErr, []uint32{10, 3, 3})
if err == nil {
t.Errorf("PMapUint32BoolErr failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUint32BoolErr(someLogicUint32BoolErr, []uint32{10, 10, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint32BoolErr failed")
}
_, err = PMapUint32BoolErr(someLogicUint32BoolErr, []uint32{3, 3, 10}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUint32BoolErr failed")
}
_, err = PMapUint32BoolErr(someLogicUint32BoolErr, []uint32{3, 10, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint32BoolErr failed")
}
_, err = PMapUint32BoolErr(someLogicUint32BoolErr, []uint32{10, 10, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint32BoolErr failed")
}
expectedList = []bool{true, true}
newList, _ = PMapUint32BoolErr(someLogicUint32BoolErr, []uint32{10, 10}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUint32Bool failed")
}
_, err = PMapUint32BoolErr(someLogicUint32BoolErr, []uint32{10, 10, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32BoolErr failed")
}
_, err = PMapUint32BoolErr(someLogicUint32BoolErr, []uint32{10, 10, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32BoolErr failed")
}
_, err = PMapUint32BoolErr(someLogicUint32BoolErr, []uint32{3, 3, 10}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32BoolErr failed")
}
_, err = PMapUint32BoolErr(someLogicUint32BoolErr, []uint32{3, 10, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32BoolErr failed")
}
_, err = PMapUint32BoolErr(someLogicUint32BoolErr, []uint32{10, 10, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32BoolErr failed")
}
}
func TestPmapUint32Float32Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []float32{2, 3}
newList, _ := PMapUint32Float32Err(plusOneUint32Float32Err, []uint32{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUint32Float32 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUint32Float32Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUint32Float32Err failed")
}
r, _ = PMapUint32Float32Err(nil, []uint32{})
if len(r) > 0 {
t.Errorf("PMapUint32Float32Err failed")
}
_, err := PMapUint32Float32Err(plusOneUint32Float32Err, []uint32{1, 2, 3})
if err == nil {
t.Errorf("PMapUint32Float32Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUint32Float32Err(plusOneUint32Float32Err, []uint32{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint32Float32Err failed")
}
_, err = PMapUint32Float32Err(plusOneUint32Float32Err, []uint32{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUint32Float32Err failed")
}
_, err = PMapUint32Float32Err(plusOneUint32Float32Err, []uint32{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint32Float32Err failed")
}
_, err = PMapUint32Float32Err(plusOneUint32Float32Err, []uint32{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint32Float32Err failed")
}
expectedList = []float32{2, 3}
newList, _ = PMapUint32Float32Err(plusOneUint32Float32Err, []uint32{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUint32Float32 failed")
}
_, err = PMapUint32Float32Err(plusOneUint32Float32Err, []uint32{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32Float32Err failed")
}
_, err = PMapUint32Float32Err(plusOneUint32Float32Err, []uint32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32Float32Err failed")
}
_, err = PMapUint32Float32Err(plusOneUint32Float32Err, []uint32{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32Float32Err failed")
}
_, err = PMapUint32Float32Err(plusOneUint32Float32Err, []uint32{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32Float32Err failed")
}
_, err = PMapUint32Float32Err(plusOneUint32Float32Err, []uint32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32Float32Err failed")
}
}
func TestPmapUint32Float64Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []float64{2, 3}
newList, _ := PMapUint32Float64Err(plusOneUint32Float64Err, []uint32{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUint32Float64 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUint32Float64Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUint32Float64Err failed")
}
r, _ = PMapUint32Float64Err(nil, []uint32{})
if len(r) > 0 {
t.Errorf("PMapUint32Float64Err failed")
}
_, err := PMapUint32Float64Err(plusOneUint32Float64Err, []uint32{1, 2, 3})
if err == nil {
t.Errorf("PMapUint32Float64Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUint32Float64Err(plusOneUint32Float64Err, []uint32{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint32Float64Err failed")
}
_, err = PMapUint32Float64Err(plusOneUint32Float64Err, []uint32{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUint32Float64Err failed")
}
_, err = PMapUint32Float64Err(plusOneUint32Float64Err, []uint32{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint32Float64Err failed")
}
_, err = PMapUint32Float64Err(plusOneUint32Float64Err, []uint32{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint32Float64Err failed")
}
expectedList = []float64{2, 3}
newList, _ = PMapUint32Float64Err(plusOneUint32Float64Err, []uint32{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUint32Float64 failed")
}
_, err = PMapUint32Float64Err(plusOneUint32Float64Err, []uint32{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32Float64Err failed")
}
_, err = PMapUint32Float64Err(plusOneUint32Float64Err, []uint32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32Float64Err failed")
}
_, err = PMapUint32Float64Err(plusOneUint32Float64Err, []uint32{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32Float64Err failed")
}
_, err = PMapUint32Float64Err(plusOneUint32Float64Err, []uint32{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32Float64Err failed")
}
_, err = PMapUint32Float64Err(plusOneUint32Float64Err, []uint32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint32Float64Err failed")
}
}
func TestPmapUint16IntErr(t *testing.T) {
// Test : add 1 to the list
expectedList := []int{2, 3}
newList, _ := PMapUint16IntErr(plusOneUint16IntErr, []uint16{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUint16Int failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUint16IntErr(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUint16IntErr failed")
}
r, _ = PMapUint16IntErr(nil, []uint16{})
if len(r) > 0 {
t.Errorf("PMapUint16IntErr failed")
}
_, err := PMapUint16IntErr(plusOneUint16IntErr, []uint16{1, 2, 3})
if err == nil {
t.Errorf("PMapUint16IntErr failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUint16IntErr(plusOneUint16IntErr, []uint16{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint16IntErr failed")
}
_, err = PMapUint16IntErr(plusOneUint16IntErr, []uint16{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUint16IntErr failed")
}
_, err = PMapUint16IntErr(plusOneUint16IntErr, []uint16{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint16IntErr failed")
}
_, err = PMapUint16IntErr(plusOneUint16IntErr, []uint16{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint16IntErr failed")
}
expectedList = []int{2, 3}
newList, _ = PMapUint16IntErr(plusOneUint16IntErr, []uint16{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUint16Int failed")
}
_, err = PMapUint16IntErr(plusOneUint16IntErr, []uint16{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16IntErr failed")
}
_, err = PMapUint16IntErr(plusOneUint16IntErr, []uint16{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16IntErr failed")
}
_, err = PMapUint16IntErr(plusOneUint16IntErr, []uint16{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16IntErr failed")
}
_, err = PMapUint16IntErr(plusOneUint16IntErr, []uint16{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16IntErr failed")
}
_, err = PMapUint16IntErr(plusOneUint16IntErr, []uint16{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16IntErr failed")
}
}
func TestPmapUint16Int64Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []int64{2, 3}
newList, _ := PMapUint16Int64Err(plusOneUint16Int64Err, []uint16{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUint16Int64 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUint16Int64Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUint16Int64Err failed")
}
r, _ = PMapUint16Int64Err(nil, []uint16{})
if len(r) > 0 {
t.Errorf("PMapUint16Int64Err failed")
}
_, err := PMapUint16Int64Err(plusOneUint16Int64Err, []uint16{1, 2, 3})
if err == nil {
t.Errorf("PMapUint16Int64Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUint16Int64Err(plusOneUint16Int64Err, []uint16{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint16Int64Err failed")
}
_, err = PMapUint16Int64Err(plusOneUint16Int64Err, []uint16{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUint16Int64Err failed")
}
_, err = PMapUint16Int64Err(plusOneUint16Int64Err, []uint16{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint16Int64Err failed")
}
_, err = PMapUint16Int64Err(plusOneUint16Int64Err, []uint16{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint16Int64Err failed")
}
expectedList = []int64{2, 3}
newList, _ = PMapUint16Int64Err(plusOneUint16Int64Err, []uint16{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUint16Int64 failed")
}
_, err = PMapUint16Int64Err(plusOneUint16Int64Err, []uint16{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16Int64Err failed")
}
_, err = PMapUint16Int64Err(plusOneUint16Int64Err, []uint16{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16Int64Err failed")
}
_, err = PMapUint16Int64Err(plusOneUint16Int64Err, []uint16{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16Int64Err failed")
}
_, err = PMapUint16Int64Err(plusOneUint16Int64Err, []uint16{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16Int64Err failed")
}
_, err = PMapUint16Int64Err(plusOneUint16Int64Err, []uint16{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16Int64Err failed")
}
}
func TestPmapUint16Int32Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []int32{2, 3}
newList, _ := PMapUint16Int32Err(plusOneUint16Int32Err, []uint16{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUint16Int32 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUint16Int32Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUint16Int32Err failed")
}
r, _ = PMapUint16Int32Err(nil, []uint16{})
if len(r) > 0 {
t.Errorf("PMapUint16Int32Err failed")
}
_, err := PMapUint16Int32Err(plusOneUint16Int32Err, []uint16{1, 2, 3})
if err == nil {
t.Errorf("PMapUint16Int32Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUint16Int32Err(plusOneUint16Int32Err, []uint16{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint16Int32Err failed")
}
_, err = PMapUint16Int32Err(plusOneUint16Int32Err, []uint16{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUint16Int32Err failed")
}
_, err = PMapUint16Int32Err(plusOneUint16Int32Err, []uint16{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint16Int32Err failed")
}
_, err = PMapUint16Int32Err(plusOneUint16Int32Err, []uint16{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint16Int32Err failed")
}
expectedList = []int32{2, 3}
newList, _ = PMapUint16Int32Err(plusOneUint16Int32Err, []uint16{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUint16Int32 failed")
}
_, err = PMapUint16Int32Err(plusOneUint16Int32Err, []uint16{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16Int32Err failed")
}
_, err = PMapUint16Int32Err(plusOneUint16Int32Err, []uint16{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16Int32Err failed")
}
_, err = PMapUint16Int32Err(plusOneUint16Int32Err, []uint16{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16Int32Err failed")
}
_, err = PMapUint16Int32Err(plusOneUint16Int32Err, []uint16{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16Int32Err failed")
}
_, err = PMapUint16Int32Err(plusOneUint16Int32Err, []uint16{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16Int32Err failed")
}
}
func TestPmapUint16Int16Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []int16{2, 3}
newList, _ := PMapUint16Int16Err(plusOneUint16Int16Err, []uint16{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUint16Int16 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUint16Int16Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUint16Int16Err failed")
}
r, _ = PMapUint16Int16Err(nil, []uint16{})
if len(r) > 0 {
t.Errorf("PMapUint16Int16Err failed")
}
_, err := PMapUint16Int16Err(plusOneUint16Int16Err, []uint16{1, 2, 3})
if err == nil {
t.Errorf("PMapUint16Int16Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUint16Int16Err(plusOneUint16Int16Err, []uint16{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint16Int16Err failed")
}
_, err = PMapUint16Int16Err(plusOneUint16Int16Err, []uint16{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUint16Int16Err failed")
}
_, err = PMapUint16Int16Err(plusOneUint16Int16Err, []uint16{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint16Int16Err failed")
}
_, err = PMapUint16Int16Err(plusOneUint16Int16Err, []uint16{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint16Int16Err failed")
}
expectedList = []int16{2, 3}
newList, _ = PMapUint16Int16Err(plusOneUint16Int16Err, []uint16{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUint16Int16 failed")
}
_, err = PMapUint16Int16Err(plusOneUint16Int16Err, []uint16{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16Int16Err failed")
}
_, err = PMapUint16Int16Err(plusOneUint16Int16Err, []uint16{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16Int16Err failed")
}
_, err = PMapUint16Int16Err(plusOneUint16Int16Err, []uint16{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16Int16Err failed")
}
_, err = PMapUint16Int16Err(plusOneUint16Int16Err, []uint16{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16Int16Err failed")
}
_, err = PMapUint16Int16Err(plusOneUint16Int16Err, []uint16{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16Int16Err failed")
}
}
func TestPmapUint16Int8Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []int8{2, 3}
newList, _ := PMapUint16Int8Err(plusOneUint16Int8Err, []uint16{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUint16Int8 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUint16Int8Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUint16Int8Err failed")
}
r, _ = PMapUint16Int8Err(nil, []uint16{})
if len(r) > 0 {
t.Errorf("PMapUint16Int8Err failed")
}
_, err := PMapUint16Int8Err(plusOneUint16Int8Err, []uint16{1, 2, 3})
if err == nil {
t.Errorf("PMapUint16Int8Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUint16Int8Err(plusOneUint16Int8Err, []uint16{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint16Int8Err failed")
}
_, err = PMapUint16Int8Err(plusOneUint16Int8Err, []uint16{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUint16Int8Err failed")
}
_, err = PMapUint16Int8Err(plusOneUint16Int8Err, []uint16{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint16Int8Err failed")
}
_, err = PMapUint16Int8Err(plusOneUint16Int8Err, []uint16{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint16Int8Err failed")
}
expectedList = []int8{2, 3}
newList, _ = PMapUint16Int8Err(plusOneUint16Int8Err, []uint16{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUint16Int8 failed")
}
_, err = PMapUint16Int8Err(plusOneUint16Int8Err, []uint16{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16Int8Err failed")
}
_, err = PMapUint16Int8Err(plusOneUint16Int8Err, []uint16{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16Int8Err failed")
}
_, err = PMapUint16Int8Err(plusOneUint16Int8Err, []uint16{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16Int8Err failed")
}
_, err = PMapUint16Int8Err(plusOneUint16Int8Err, []uint16{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16Int8Err failed")
}
_, err = PMapUint16Int8Err(plusOneUint16Int8Err, []uint16{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16Int8Err failed")
}
}
func TestPmapUint16UintErr(t *testing.T) {
// Test : add 1 to the list
expectedList := []uint{2, 3}
newList, _ := PMapUint16UintErr(plusOneUint16UintErr, []uint16{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUint16Uint failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUint16UintErr(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUint16UintErr failed")
}
r, _ = PMapUint16UintErr(nil, []uint16{})
if len(r) > 0 {
t.Errorf("PMapUint16UintErr failed")
}
_, err := PMapUint16UintErr(plusOneUint16UintErr, []uint16{1, 2, 3})
if err == nil {
t.Errorf("PMapUint16UintErr failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUint16UintErr(plusOneUint16UintErr, []uint16{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint16UintErr failed")
}
_, err = PMapUint16UintErr(plusOneUint16UintErr, []uint16{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUint16UintErr failed")
}
_, err = PMapUint16UintErr(plusOneUint16UintErr, []uint16{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint16UintErr failed")
}
_, err = PMapUint16UintErr(plusOneUint16UintErr, []uint16{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint16UintErr failed")
}
expectedList = []uint{2, 3}
newList, _ = PMapUint16UintErr(plusOneUint16UintErr, []uint16{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUint16Uint failed")
}
_, err = PMapUint16UintErr(plusOneUint16UintErr, []uint16{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16UintErr failed")
}
_, err = PMapUint16UintErr(plusOneUint16UintErr, []uint16{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16UintErr failed")
}
_, err = PMapUint16UintErr(plusOneUint16UintErr, []uint16{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16UintErr failed")
}
_, err = PMapUint16UintErr(plusOneUint16UintErr, []uint16{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16UintErr failed")
}
_, err = PMapUint16UintErr(plusOneUint16UintErr, []uint16{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16UintErr failed")
}
}
func TestPmapUint16Uint64Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []uint64{2, 3}
newList, _ := PMapUint16Uint64Err(plusOneUint16Uint64Err, []uint16{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUint16Uint64 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUint16Uint64Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUint16Uint64Err failed")
}
r, _ = PMapUint16Uint64Err(nil, []uint16{})
if len(r) > 0 {
t.Errorf("PMapUint16Uint64Err failed")
}
_, err := PMapUint16Uint64Err(plusOneUint16Uint64Err, []uint16{1, 2, 3})
if err == nil {
t.Errorf("PMapUint16Uint64Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUint16Uint64Err(plusOneUint16Uint64Err, []uint16{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint16Uint64Err failed")
}
_, err = PMapUint16Uint64Err(plusOneUint16Uint64Err, []uint16{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUint16Uint64Err failed")
}
_, err = PMapUint16Uint64Err(plusOneUint16Uint64Err, []uint16{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint16Uint64Err failed")
}
_, err = PMapUint16Uint64Err(plusOneUint16Uint64Err, []uint16{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint16Uint64Err failed")
}
expectedList = []uint64{2, 3}
newList, _ = PMapUint16Uint64Err(plusOneUint16Uint64Err, []uint16{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUint16Uint64 failed")
}
_, err = PMapUint16Uint64Err(plusOneUint16Uint64Err, []uint16{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16Uint64Err failed")
}
_, err = PMapUint16Uint64Err(plusOneUint16Uint64Err, []uint16{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16Uint64Err failed")
}
_, err = PMapUint16Uint64Err(plusOneUint16Uint64Err, []uint16{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16Uint64Err failed")
}
_, err = PMapUint16Uint64Err(plusOneUint16Uint64Err, []uint16{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16Uint64Err failed")
}
_, err = PMapUint16Uint64Err(plusOneUint16Uint64Err, []uint16{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16Uint64Err failed")
}
}
func TestPmapUint16Uint32Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []uint32{2, 3}
newList, _ := PMapUint16Uint32Err(plusOneUint16Uint32Err, []uint16{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUint16Uint32 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUint16Uint32Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUint16Uint32Err failed")
}
r, _ = PMapUint16Uint32Err(nil, []uint16{})
if len(r) > 0 {
t.Errorf("PMapUint16Uint32Err failed")
}
_, err := PMapUint16Uint32Err(plusOneUint16Uint32Err, []uint16{1, 2, 3})
if err == nil {
t.Errorf("PMapUint16Uint32Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUint16Uint32Err(plusOneUint16Uint32Err, []uint16{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint16Uint32Err failed")
}
_, err = PMapUint16Uint32Err(plusOneUint16Uint32Err, []uint16{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUint16Uint32Err failed")
}
_, err = PMapUint16Uint32Err(plusOneUint16Uint32Err, []uint16{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint16Uint32Err failed")
}
_, err = PMapUint16Uint32Err(plusOneUint16Uint32Err, []uint16{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint16Uint32Err failed")
}
expectedList = []uint32{2, 3}
newList, _ = PMapUint16Uint32Err(plusOneUint16Uint32Err, []uint16{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUint16Uint32 failed")
}
_, err = PMapUint16Uint32Err(plusOneUint16Uint32Err, []uint16{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16Uint32Err failed")
}
_, err = PMapUint16Uint32Err(plusOneUint16Uint32Err, []uint16{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16Uint32Err failed")
}
_, err = PMapUint16Uint32Err(plusOneUint16Uint32Err, []uint16{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16Uint32Err failed")
}
_, err = PMapUint16Uint32Err(plusOneUint16Uint32Err, []uint16{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16Uint32Err failed")
}
_, err = PMapUint16Uint32Err(plusOneUint16Uint32Err, []uint16{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16Uint32Err failed")
}
}
func TestPmapUint16Uint8Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []uint8{2, 3}
newList, _ := PMapUint16Uint8Err(plusOneUint16Uint8Err, []uint16{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUint16Uint8 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUint16Uint8Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUint16Uint8Err failed")
}
r, _ = PMapUint16Uint8Err(nil, []uint16{})
if len(r) > 0 {
t.Errorf("PMapUint16Uint8Err failed")
}
_, err := PMapUint16Uint8Err(plusOneUint16Uint8Err, []uint16{1, 2, 3})
if err == nil {
t.Errorf("PMapUint16Uint8Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUint16Uint8Err(plusOneUint16Uint8Err, []uint16{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint16Uint8Err failed")
}
_, err = PMapUint16Uint8Err(plusOneUint16Uint8Err, []uint16{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUint16Uint8Err failed")
}
_, err = PMapUint16Uint8Err(plusOneUint16Uint8Err, []uint16{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint16Uint8Err failed")
}
_, err = PMapUint16Uint8Err(plusOneUint16Uint8Err, []uint16{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint16Uint8Err failed")
}
expectedList = []uint8{2, 3}
newList, _ = PMapUint16Uint8Err(plusOneUint16Uint8Err, []uint16{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUint16Uint8 failed")
}
_, err = PMapUint16Uint8Err(plusOneUint16Uint8Err, []uint16{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16Uint8Err failed")
}
_, err = PMapUint16Uint8Err(plusOneUint16Uint8Err, []uint16{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16Uint8Err failed")
}
_, err = PMapUint16Uint8Err(plusOneUint16Uint8Err, []uint16{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16Uint8Err failed")
}
_, err = PMapUint16Uint8Err(plusOneUint16Uint8Err, []uint16{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16Uint8Err failed")
}
_, err = PMapUint16Uint8Err(plusOneUint16Uint8Err, []uint16{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16Uint8Err failed")
}
}
func TestPmapUint16StrErr(t *testing.T) {
// Test : someLogic
expectedList := []string{"10"}
newList, _ := PMapUint16StrErr(someLogicUint16StrErr, []uint16{10})
if newList[0] != expectedList[0] {
t.Errorf("PMapUint16StrErr failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUint16StrErr(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUint16StrErr failed")
}
r, _ = PMapUint16StrErr(nil, []uint16{})
if len(r) > 0 {
t.Errorf("PMapUint16StrErr failed")
}
_, err := PMapUint16StrErr(someLogicUint16StrErr, []uint16{10, 0})
if err == nil {
t.Errorf("PMapUint16StrErr failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUint16StrErr(someLogicUint16StrErr, []uint16{10, 10, 0}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint16StrErr failed")
}
_, err = PMapUint16StrErr(someLogicUint16StrErr, []uint16{0, 0, 10}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUint16StrErr failed")
}
_, err = PMapUint16StrErr(someLogicUint16StrErr, []uint16{0, 10, 0}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint16StrErr failed")
}
_, err = PMapUint16StrErr(someLogicUint16StrErr, []uint16{10, 10, 0}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint16StrErr failed")
}
expectedList = []string{"10", "10"}
newList, _ = PMapUint16StrErr(someLogicUint16StrErr, []uint16{10, 10}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUint16Str failed")
}
_, err = PMapUint16StrErr(someLogicUint16StrErr, []uint16{10, 10, 0}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16StrErr failed")
}
_, err = PMapUint16StrErr(someLogicUint16StrErr, []uint16{10, 10, 0}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16StrErr failed")
}
_, err = PMapUint16StrErr(someLogicUint16StrErr, []uint16{0, 0, 10}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16StrErr failed")
}
_, err = PMapUint16StrErr(someLogicUint16StrErr, []uint16{0, 10, 0}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16StrErr failed")
}
_, err = PMapUint16StrErr(someLogicUint16StrErr, []uint16{10, 10, 0}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16StrErr failed")
}
}
func TestPmapUint16BoolErr(t *testing.T) {
// Test : someLogic
expectedList := []bool{true, false}
newList, _ := PMapUint16BoolErr(someLogicUint16BoolErr, []uint16{10, 0})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUint16BoolErr failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUint16BoolErr(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUint16BoolErr failed")
}
r, _ = PMapUint16BoolErr(nil, []uint16{})
if len(r) > 0 {
t.Errorf("PMapUint16BoolErr failed")
}
_, err := PMapUint16BoolErr(someLogicUint16BoolErr, []uint16{10, 3, 3})
if err == nil {
t.Errorf("PMapUint16BoolErr failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUint16BoolErr(someLogicUint16BoolErr, []uint16{10, 10, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint16BoolErr failed")
}
_, err = PMapUint16BoolErr(someLogicUint16BoolErr, []uint16{3, 3, 10}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUint16BoolErr failed")
}
_, err = PMapUint16BoolErr(someLogicUint16BoolErr, []uint16{3, 10, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint16BoolErr failed")
}
_, err = PMapUint16BoolErr(someLogicUint16BoolErr, []uint16{10, 10, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint16BoolErr failed")
}
expectedList = []bool{true, true}
newList, _ = PMapUint16BoolErr(someLogicUint16BoolErr, []uint16{10, 10}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUint16Bool failed")
}
_, err = PMapUint16BoolErr(someLogicUint16BoolErr, []uint16{10, 10, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16BoolErr failed")
}
_, err = PMapUint16BoolErr(someLogicUint16BoolErr, []uint16{10, 10, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16BoolErr failed")
}
_, err = PMapUint16BoolErr(someLogicUint16BoolErr, []uint16{3, 3, 10}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16BoolErr failed")
}
_, err = PMapUint16BoolErr(someLogicUint16BoolErr, []uint16{3, 10, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16BoolErr failed")
}
_, err = PMapUint16BoolErr(someLogicUint16BoolErr, []uint16{10, 10, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16BoolErr failed")
}
}
func TestPmapUint16Float32Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []float32{2, 3}
newList, _ := PMapUint16Float32Err(plusOneUint16Float32Err, []uint16{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUint16Float32 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUint16Float32Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUint16Float32Err failed")
}
r, _ = PMapUint16Float32Err(nil, []uint16{})
if len(r) > 0 {
t.Errorf("PMapUint16Float32Err failed")
}
_, err := PMapUint16Float32Err(plusOneUint16Float32Err, []uint16{1, 2, 3})
if err == nil {
t.Errorf("PMapUint16Float32Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUint16Float32Err(plusOneUint16Float32Err, []uint16{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint16Float32Err failed")
}
_, err = PMapUint16Float32Err(plusOneUint16Float32Err, []uint16{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUint16Float32Err failed")
}
_, err = PMapUint16Float32Err(plusOneUint16Float32Err, []uint16{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint16Float32Err failed")
}
_, err = PMapUint16Float32Err(plusOneUint16Float32Err, []uint16{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint16Float32Err failed")
}
expectedList = []float32{2, 3}
newList, _ = PMapUint16Float32Err(plusOneUint16Float32Err, []uint16{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUint16Float32 failed")
}
_, err = PMapUint16Float32Err(plusOneUint16Float32Err, []uint16{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16Float32Err failed")
}
_, err = PMapUint16Float32Err(plusOneUint16Float32Err, []uint16{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16Float32Err failed")
}
_, err = PMapUint16Float32Err(plusOneUint16Float32Err, []uint16{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16Float32Err failed")
}
_, err = PMapUint16Float32Err(plusOneUint16Float32Err, []uint16{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16Float32Err failed")
}
_, err = PMapUint16Float32Err(plusOneUint16Float32Err, []uint16{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16Float32Err failed")
}
}
func TestPmapUint16Float64Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []float64{2, 3}
newList, _ := PMapUint16Float64Err(plusOneUint16Float64Err, []uint16{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUint16Float64 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUint16Float64Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUint16Float64Err failed")
}
r, _ = PMapUint16Float64Err(nil, []uint16{})
if len(r) > 0 {
t.Errorf("PMapUint16Float64Err failed")
}
_, err := PMapUint16Float64Err(plusOneUint16Float64Err, []uint16{1, 2, 3})
if err == nil {
t.Errorf("PMapUint16Float64Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUint16Float64Err(plusOneUint16Float64Err, []uint16{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint16Float64Err failed")
}
_, err = PMapUint16Float64Err(plusOneUint16Float64Err, []uint16{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUint16Float64Err failed")
}
_, err = PMapUint16Float64Err(plusOneUint16Float64Err, []uint16{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint16Float64Err failed")
}
_, err = PMapUint16Float64Err(plusOneUint16Float64Err, []uint16{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint16Float64Err failed")
}
expectedList = []float64{2, 3}
newList, _ = PMapUint16Float64Err(plusOneUint16Float64Err, []uint16{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUint16Float64 failed")
}
_, err = PMapUint16Float64Err(plusOneUint16Float64Err, []uint16{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16Float64Err failed")
}
_, err = PMapUint16Float64Err(plusOneUint16Float64Err, []uint16{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16Float64Err failed")
}
_, err = PMapUint16Float64Err(plusOneUint16Float64Err, []uint16{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16Float64Err failed")
}
_, err = PMapUint16Float64Err(plusOneUint16Float64Err, []uint16{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16Float64Err failed")
}
_, err = PMapUint16Float64Err(plusOneUint16Float64Err, []uint16{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint16Float64Err failed")
}
}
func TestPmapUint8IntErr(t *testing.T) {
// Test : add 1 to the list
expectedList := []int{2, 3}
newList, _ := PMapUint8IntErr(plusOneUint8IntErr, []uint8{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUint8Int failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUint8IntErr(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUint8IntErr failed")
}
r, _ = PMapUint8IntErr(nil, []uint8{})
if len(r) > 0 {
t.Errorf("PMapUint8IntErr failed")
}
_, err := PMapUint8IntErr(plusOneUint8IntErr, []uint8{1, 2, 3})
if err == nil {
t.Errorf("PMapUint8IntErr failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUint8IntErr(plusOneUint8IntErr, []uint8{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint8IntErr failed")
}
_, err = PMapUint8IntErr(plusOneUint8IntErr, []uint8{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUint8IntErr failed")
}
_, err = PMapUint8IntErr(plusOneUint8IntErr, []uint8{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint8IntErr failed")
}
_, err = PMapUint8IntErr(plusOneUint8IntErr, []uint8{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint8IntErr failed")
}
expectedList = []int{2, 3}
newList, _ = PMapUint8IntErr(plusOneUint8IntErr, []uint8{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUint8Int failed")
}
_, err = PMapUint8IntErr(plusOneUint8IntErr, []uint8{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8IntErr failed")
}
_, err = PMapUint8IntErr(plusOneUint8IntErr, []uint8{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8IntErr failed")
}
_, err = PMapUint8IntErr(plusOneUint8IntErr, []uint8{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8IntErr failed")
}
_, err = PMapUint8IntErr(plusOneUint8IntErr, []uint8{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8IntErr failed")
}
_, err = PMapUint8IntErr(plusOneUint8IntErr, []uint8{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8IntErr failed")
}
}
func TestPmapUint8Int64Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []int64{2, 3}
newList, _ := PMapUint8Int64Err(plusOneUint8Int64Err, []uint8{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUint8Int64 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUint8Int64Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUint8Int64Err failed")
}
r, _ = PMapUint8Int64Err(nil, []uint8{})
if len(r) > 0 {
t.Errorf("PMapUint8Int64Err failed")
}
_, err := PMapUint8Int64Err(plusOneUint8Int64Err, []uint8{1, 2, 3})
if err == nil {
t.Errorf("PMapUint8Int64Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUint8Int64Err(plusOneUint8Int64Err, []uint8{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint8Int64Err failed")
}
_, err = PMapUint8Int64Err(plusOneUint8Int64Err, []uint8{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUint8Int64Err failed")
}
_, err = PMapUint8Int64Err(plusOneUint8Int64Err, []uint8{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint8Int64Err failed")
}
_, err = PMapUint8Int64Err(plusOneUint8Int64Err, []uint8{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint8Int64Err failed")
}
expectedList = []int64{2, 3}
newList, _ = PMapUint8Int64Err(plusOneUint8Int64Err, []uint8{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUint8Int64 failed")
}
_, err = PMapUint8Int64Err(plusOneUint8Int64Err, []uint8{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8Int64Err failed")
}
_, err = PMapUint8Int64Err(plusOneUint8Int64Err, []uint8{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8Int64Err failed")
}
_, err = PMapUint8Int64Err(plusOneUint8Int64Err, []uint8{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8Int64Err failed")
}
_, err = PMapUint8Int64Err(plusOneUint8Int64Err, []uint8{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8Int64Err failed")
}
_, err = PMapUint8Int64Err(plusOneUint8Int64Err, []uint8{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8Int64Err failed")
}
}
func TestPmapUint8Int32Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []int32{2, 3}
newList, _ := PMapUint8Int32Err(plusOneUint8Int32Err, []uint8{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUint8Int32 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUint8Int32Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUint8Int32Err failed")
}
r, _ = PMapUint8Int32Err(nil, []uint8{})
if len(r) > 0 {
t.Errorf("PMapUint8Int32Err failed")
}
_, err := PMapUint8Int32Err(plusOneUint8Int32Err, []uint8{1, 2, 3})
if err == nil {
t.Errorf("PMapUint8Int32Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUint8Int32Err(plusOneUint8Int32Err, []uint8{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint8Int32Err failed")
}
_, err = PMapUint8Int32Err(plusOneUint8Int32Err, []uint8{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUint8Int32Err failed")
}
_, err = PMapUint8Int32Err(plusOneUint8Int32Err, []uint8{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint8Int32Err failed")
}
_, err = PMapUint8Int32Err(plusOneUint8Int32Err, []uint8{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint8Int32Err failed")
}
expectedList = []int32{2, 3}
newList, _ = PMapUint8Int32Err(plusOneUint8Int32Err, []uint8{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUint8Int32 failed")
}
_, err = PMapUint8Int32Err(plusOneUint8Int32Err, []uint8{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8Int32Err failed")
}
_, err = PMapUint8Int32Err(plusOneUint8Int32Err, []uint8{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8Int32Err failed")
}
_, err = PMapUint8Int32Err(plusOneUint8Int32Err, []uint8{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8Int32Err failed")
}
_, err = PMapUint8Int32Err(plusOneUint8Int32Err, []uint8{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8Int32Err failed")
}
_, err = PMapUint8Int32Err(plusOneUint8Int32Err, []uint8{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8Int32Err failed")
}
}
func TestPmapUint8Int16Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []int16{2, 3}
newList, _ := PMapUint8Int16Err(plusOneUint8Int16Err, []uint8{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUint8Int16 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUint8Int16Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUint8Int16Err failed")
}
r, _ = PMapUint8Int16Err(nil, []uint8{})
if len(r) > 0 {
t.Errorf("PMapUint8Int16Err failed")
}
_, err := PMapUint8Int16Err(plusOneUint8Int16Err, []uint8{1, 2, 3})
if err == nil {
t.Errorf("PMapUint8Int16Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUint8Int16Err(plusOneUint8Int16Err, []uint8{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint8Int16Err failed")
}
_, err = PMapUint8Int16Err(plusOneUint8Int16Err, []uint8{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUint8Int16Err failed")
}
_, err = PMapUint8Int16Err(plusOneUint8Int16Err, []uint8{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint8Int16Err failed")
}
_, err = PMapUint8Int16Err(plusOneUint8Int16Err, []uint8{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint8Int16Err failed")
}
expectedList = []int16{2, 3}
newList, _ = PMapUint8Int16Err(plusOneUint8Int16Err, []uint8{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUint8Int16 failed")
}
_, err = PMapUint8Int16Err(plusOneUint8Int16Err, []uint8{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8Int16Err failed")
}
_, err = PMapUint8Int16Err(plusOneUint8Int16Err, []uint8{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8Int16Err failed")
}
_, err = PMapUint8Int16Err(plusOneUint8Int16Err, []uint8{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8Int16Err failed")
}
_, err = PMapUint8Int16Err(plusOneUint8Int16Err, []uint8{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8Int16Err failed")
}
_, err = PMapUint8Int16Err(plusOneUint8Int16Err, []uint8{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8Int16Err failed")
}
}
func TestPmapUint8Int8Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []int8{2, 3}
newList, _ := PMapUint8Int8Err(plusOneUint8Int8Err, []uint8{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUint8Int8 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUint8Int8Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUint8Int8Err failed")
}
r, _ = PMapUint8Int8Err(nil, []uint8{})
if len(r) > 0 {
t.Errorf("PMapUint8Int8Err failed")
}
_, err := PMapUint8Int8Err(plusOneUint8Int8Err, []uint8{1, 2, 3})
if err == nil {
t.Errorf("PMapUint8Int8Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUint8Int8Err(plusOneUint8Int8Err, []uint8{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint8Int8Err failed")
}
_, err = PMapUint8Int8Err(plusOneUint8Int8Err, []uint8{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUint8Int8Err failed")
}
_, err = PMapUint8Int8Err(plusOneUint8Int8Err, []uint8{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint8Int8Err failed")
}
_, err = PMapUint8Int8Err(plusOneUint8Int8Err, []uint8{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint8Int8Err failed")
}
expectedList = []int8{2, 3}
newList, _ = PMapUint8Int8Err(plusOneUint8Int8Err, []uint8{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUint8Int8 failed")
}
_, err = PMapUint8Int8Err(plusOneUint8Int8Err, []uint8{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8Int8Err failed")
}
_, err = PMapUint8Int8Err(plusOneUint8Int8Err, []uint8{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8Int8Err failed")
}
_, err = PMapUint8Int8Err(plusOneUint8Int8Err, []uint8{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8Int8Err failed")
}
_, err = PMapUint8Int8Err(plusOneUint8Int8Err, []uint8{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8Int8Err failed")
}
_, err = PMapUint8Int8Err(plusOneUint8Int8Err, []uint8{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8Int8Err failed")
}
}
func TestPmapUint8UintErr(t *testing.T) {
// Test : add 1 to the list
expectedList := []uint{2, 3}
newList, _ := PMapUint8UintErr(plusOneUint8UintErr, []uint8{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUint8Uint failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUint8UintErr(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUint8UintErr failed")
}
r, _ = PMapUint8UintErr(nil, []uint8{})
if len(r) > 0 {
t.Errorf("PMapUint8UintErr failed")
}
_, err := PMapUint8UintErr(plusOneUint8UintErr, []uint8{1, 2, 3})
if err == nil {
t.Errorf("PMapUint8UintErr failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUint8UintErr(plusOneUint8UintErr, []uint8{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint8UintErr failed")
}
_, err = PMapUint8UintErr(plusOneUint8UintErr, []uint8{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUint8UintErr failed")
}
_, err = PMapUint8UintErr(plusOneUint8UintErr, []uint8{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint8UintErr failed")
}
_, err = PMapUint8UintErr(plusOneUint8UintErr, []uint8{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint8UintErr failed")
}
expectedList = []uint{2, 3}
newList, _ = PMapUint8UintErr(plusOneUint8UintErr, []uint8{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUint8Uint failed")
}
_, err = PMapUint8UintErr(plusOneUint8UintErr, []uint8{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8UintErr failed")
}
_, err = PMapUint8UintErr(plusOneUint8UintErr, []uint8{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8UintErr failed")
}
_, err = PMapUint8UintErr(plusOneUint8UintErr, []uint8{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8UintErr failed")
}
_, err = PMapUint8UintErr(plusOneUint8UintErr, []uint8{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8UintErr failed")
}
_, err = PMapUint8UintErr(plusOneUint8UintErr, []uint8{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8UintErr failed")
}
}
func TestPmapUint8Uint64Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []uint64{2, 3}
newList, _ := PMapUint8Uint64Err(plusOneUint8Uint64Err, []uint8{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUint8Uint64 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUint8Uint64Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUint8Uint64Err failed")
}
r, _ = PMapUint8Uint64Err(nil, []uint8{})
if len(r) > 0 {
t.Errorf("PMapUint8Uint64Err failed")
}
_, err := PMapUint8Uint64Err(plusOneUint8Uint64Err, []uint8{1, 2, 3})
if err == nil {
t.Errorf("PMapUint8Uint64Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUint8Uint64Err(plusOneUint8Uint64Err, []uint8{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint8Uint64Err failed")
}
_, err = PMapUint8Uint64Err(plusOneUint8Uint64Err, []uint8{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUint8Uint64Err failed")
}
_, err = PMapUint8Uint64Err(plusOneUint8Uint64Err, []uint8{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint8Uint64Err failed")
}
_, err = PMapUint8Uint64Err(plusOneUint8Uint64Err, []uint8{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint8Uint64Err failed")
}
expectedList = []uint64{2, 3}
newList, _ = PMapUint8Uint64Err(plusOneUint8Uint64Err, []uint8{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUint8Uint64 failed")
}
_, err = PMapUint8Uint64Err(plusOneUint8Uint64Err, []uint8{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8Uint64Err failed")
}
_, err = PMapUint8Uint64Err(plusOneUint8Uint64Err, []uint8{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8Uint64Err failed")
}
_, err = PMapUint8Uint64Err(plusOneUint8Uint64Err, []uint8{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8Uint64Err failed")
}
_, err = PMapUint8Uint64Err(plusOneUint8Uint64Err, []uint8{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8Uint64Err failed")
}
_, err = PMapUint8Uint64Err(plusOneUint8Uint64Err, []uint8{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8Uint64Err failed")
}
}
func TestPmapUint8Uint32Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []uint32{2, 3}
newList, _ := PMapUint8Uint32Err(plusOneUint8Uint32Err, []uint8{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUint8Uint32 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUint8Uint32Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUint8Uint32Err failed")
}
r, _ = PMapUint8Uint32Err(nil, []uint8{})
if len(r) > 0 {
t.Errorf("PMapUint8Uint32Err failed")
}
_, err := PMapUint8Uint32Err(plusOneUint8Uint32Err, []uint8{1, 2, 3})
if err == nil {
t.Errorf("PMapUint8Uint32Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUint8Uint32Err(plusOneUint8Uint32Err, []uint8{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint8Uint32Err failed")
}
_, err = PMapUint8Uint32Err(plusOneUint8Uint32Err, []uint8{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUint8Uint32Err failed")
}
_, err = PMapUint8Uint32Err(plusOneUint8Uint32Err, []uint8{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint8Uint32Err failed")
}
_, err = PMapUint8Uint32Err(plusOneUint8Uint32Err, []uint8{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint8Uint32Err failed")
}
expectedList = []uint32{2, 3}
newList, _ = PMapUint8Uint32Err(plusOneUint8Uint32Err, []uint8{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUint8Uint32 failed")
}
_, err = PMapUint8Uint32Err(plusOneUint8Uint32Err, []uint8{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8Uint32Err failed")
}
_, err = PMapUint8Uint32Err(plusOneUint8Uint32Err, []uint8{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8Uint32Err failed")
}
_, err = PMapUint8Uint32Err(plusOneUint8Uint32Err, []uint8{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8Uint32Err failed")
}
_, err = PMapUint8Uint32Err(plusOneUint8Uint32Err, []uint8{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8Uint32Err failed")
}
_, err = PMapUint8Uint32Err(plusOneUint8Uint32Err, []uint8{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8Uint32Err failed")
}
}
func TestPmapUint8Uint16Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []uint16{2, 3}
newList, _ := PMapUint8Uint16Err(plusOneUint8Uint16Err, []uint8{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUint8Uint16 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUint8Uint16Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUint8Uint16Err failed")
}
r, _ = PMapUint8Uint16Err(nil, []uint8{})
if len(r) > 0 {
t.Errorf("PMapUint8Uint16Err failed")
}
_, err := PMapUint8Uint16Err(plusOneUint8Uint16Err, []uint8{1, 2, 3})
if err == nil {
t.Errorf("PMapUint8Uint16Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUint8Uint16Err(plusOneUint8Uint16Err, []uint8{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint8Uint16Err failed")
}
_, err = PMapUint8Uint16Err(plusOneUint8Uint16Err, []uint8{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUint8Uint16Err failed")
}
_, err = PMapUint8Uint16Err(plusOneUint8Uint16Err, []uint8{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint8Uint16Err failed")
}
_, err = PMapUint8Uint16Err(plusOneUint8Uint16Err, []uint8{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint8Uint16Err failed")
}
expectedList = []uint16{2, 3}
newList, _ = PMapUint8Uint16Err(plusOneUint8Uint16Err, []uint8{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUint8Uint16 failed")
}
_, err = PMapUint8Uint16Err(plusOneUint8Uint16Err, []uint8{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8Uint16Err failed")
}
_, err = PMapUint8Uint16Err(plusOneUint8Uint16Err, []uint8{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8Uint16Err failed")
}
_, err = PMapUint8Uint16Err(plusOneUint8Uint16Err, []uint8{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8Uint16Err failed")
}
_, err = PMapUint8Uint16Err(plusOneUint8Uint16Err, []uint8{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8Uint16Err failed")
}
_, err = PMapUint8Uint16Err(plusOneUint8Uint16Err, []uint8{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8Uint16Err failed")
}
}
func TestPmapUint8StrErr(t *testing.T) {
// Test : someLogic
expectedList := []string{"10"}
newList, _ := PMapUint8StrErr(someLogicUint8StrErr, []uint8{10})
if newList[0] != expectedList[0] {
t.Errorf("PMapUint8StrErr failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUint8StrErr(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUint8StrErr failed")
}
r, _ = PMapUint8StrErr(nil, []uint8{})
if len(r) > 0 {
t.Errorf("PMapUint8StrErr failed")
}
_, err := PMapUint8StrErr(someLogicUint8StrErr, []uint8{10, 0})
if err == nil {
t.Errorf("PMapUint8StrErr failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUint8StrErr(someLogicUint8StrErr, []uint8{10, 10, 0}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint8StrErr failed")
}
_, err = PMapUint8StrErr(someLogicUint8StrErr, []uint8{0, 0, 10}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUint8StrErr failed")
}
_, err = PMapUint8StrErr(someLogicUint8StrErr, []uint8{0, 10, 0}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint8StrErr failed")
}
_, err = PMapUint8StrErr(someLogicUint8StrErr, []uint8{10, 10, 0}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint8StrErr failed")
}
expectedList = []string{"10", "10"}
newList, _ = PMapUint8StrErr(someLogicUint8StrErr, []uint8{10, 10}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUint8Str failed")
}
_, err = PMapUint8StrErr(someLogicUint8StrErr, []uint8{10, 10, 0}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8StrErr failed")
}
_, err = PMapUint8StrErr(someLogicUint8StrErr, []uint8{10, 10, 0}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8StrErr failed")
}
_, err = PMapUint8StrErr(someLogicUint8StrErr, []uint8{0, 0, 10}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8StrErr failed")
}
_, err = PMapUint8StrErr(someLogicUint8StrErr, []uint8{0, 10, 0}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8StrErr failed")
}
_, err = PMapUint8StrErr(someLogicUint8StrErr, []uint8{10, 10, 0}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8StrErr failed")
}
}
func TestPmapUint8BoolErr(t *testing.T) {
// Test : someLogic
expectedList := []bool{true, false}
newList, _ := PMapUint8BoolErr(someLogicUint8BoolErr, []uint8{10, 0})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUint8BoolErr failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUint8BoolErr(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUint8BoolErr failed")
}
r, _ = PMapUint8BoolErr(nil, []uint8{})
if len(r) > 0 {
t.Errorf("PMapUint8BoolErr failed")
}
_, err := PMapUint8BoolErr(someLogicUint8BoolErr, []uint8{10, 3, 3})
if err == nil {
t.Errorf("PMapUint8BoolErr failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUint8BoolErr(someLogicUint8BoolErr, []uint8{10, 10, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint8BoolErr failed")
}
_, err = PMapUint8BoolErr(someLogicUint8BoolErr, []uint8{3, 3, 10}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUint8BoolErr failed")
}
_, err = PMapUint8BoolErr(someLogicUint8BoolErr, []uint8{3, 10, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint8BoolErr failed")
}
_, err = PMapUint8BoolErr(someLogicUint8BoolErr, []uint8{10, 10, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint8BoolErr failed")
}
expectedList = []bool{true, true}
newList, _ = PMapUint8BoolErr(someLogicUint8BoolErr, []uint8{10, 10}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUint8Bool failed")
}
_, err = PMapUint8BoolErr(someLogicUint8BoolErr, []uint8{10, 10, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8BoolErr failed")
}
_, err = PMapUint8BoolErr(someLogicUint8BoolErr, []uint8{10, 10, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8BoolErr failed")
}
_, err = PMapUint8BoolErr(someLogicUint8BoolErr, []uint8{3, 3, 10}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8BoolErr failed")
}
_, err = PMapUint8BoolErr(someLogicUint8BoolErr, []uint8{3, 10, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8BoolErr failed")
}
_, err = PMapUint8BoolErr(someLogicUint8BoolErr, []uint8{10, 10, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8BoolErr failed")
}
}
func TestPmapUint8Float32Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []float32{2, 3}
newList, _ := PMapUint8Float32Err(plusOneUint8Float32Err, []uint8{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUint8Float32 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUint8Float32Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUint8Float32Err failed")
}
r, _ = PMapUint8Float32Err(nil, []uint8{})
if len(r) > 0 {
t.Errorf("PMapUint8Float32Err failed")
}
_, err := PMapUint8Float32Err(plusOneUint8Float32Err, []uint8{1, 2, 3})
if err == nil {
t.Errorf("PMapUint8Float32Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUint8Float32Err(plusOneUint8Float32Err, []uint8{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint8Float32Err failed")
}
_, err = PMapUint8Float32Err(plusOneUint8Float32Err, []uint8{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUint8Float32Err failed")
}
_, err = PMapUint8Float32Err(plusOneUint8Float32Err, []uint8{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint8Float32Err failed")
}
_, err = PMapUint8Float32Err(plusOneUint8Float32Err, []uint8{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint8Float32Err failed")
}
expectedList = []float32{2, 3}
newList, _ = PMapUint8Float32Err(plusOneUint8Float32Err, []uint8{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUint8Float32 failed")
}
_, err = PMapUint8Float32Err(plusOneUint8Float32Err, []uint8{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8Float32Err failed")
}
_, err = PMapUint8Float32Err(plusOneUint8Float32Err, []uint8{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8Float32Err failed")
}
_, err = PMapUint8Float32Err(plusOneUint8Float32Err, []uint8{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8Float32Err failed")
}
_, err = PMapUint8Float32Err(plusOneUint8Float32Err, []uint8{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8Float32Err failed")
}
_, err = PMapUint8Float32Err(plusOneUint8Float32Err, []uint8{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8Float32Err failed")
}
}
func TestPmapUint8Float64Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []float64{2, 3}
newList, _ := PMapUint8Float64Err(plusOneUint8Float64Err, []uint8{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapUint8Float64 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapUint8Float64Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapUint8Float64Err failed")
}
r, _ = PMapUint8Float64Err(nil, []uint8{})
if len(r) > 0 {
t.Errorf("PMapUint8Float64Err failed")
}
_, err := PMapUint8Float64Err(plusOneUint8Float64Err, []uint8{1, 2, 3})
if err == nil {
t.Errorf("PMapUint8Float64Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapUint8Float64Err(plusOneUint8Float64Err, []uint8{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint8Float64Err failed")
}
_, err = PMapUint8Float64Err(plusOneUint8Float64Err, []uint8{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapUint8Float64Err failed")
}
_, err = PMapUint8Float64Err(plusOneUint8Float64Err, []uint8{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint8Float64Err failed")
}
_, err = PMapUint8Float64Err(plusOneUint8Float64Err, []uint8{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapUint8Float64Err failed")
}
expectedList = []float64{2, 3}
newList, _ = PMapUint8Float64Err(plusOneUint8Float64Err, []uint8{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapUint8Float64 failed")
}
_, err = PMapUint8Float64Err(plusOneUint8Float64Err, []uint8{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8Float64Err failed")
}
_, err = PMapUint8Float64Err(plusOneUint8Float64Err, []uint8{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8Float64Err failed")
}
_, err = PMapUint8Float64Err(plusOneUint8Float64Err, []uint8{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8Float64Err failed")
}
_, err = PMapUint8Float64Err(plusOneUint8Float64Err, []uint8{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8Float64Err failed")
}
_, err = PMapUint8Float64Err(plusOneUint8Float64Err, []uint8{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapUint8Float64Err failed")
}
}
func TestPmapStrIntErr(t *testing.T) {
// Test : someLogic
expectedList := []int{10}
newList, _ := PMapStrIntErr(someLogicStrIntErr, []string{"ten"})
if newList[0] != expectedList[0] {
t.Errorf("PMapStrIntErr failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapStrIntErr(nil, nil)
if len(r) > 0 {
t.Errorf("PMapStrIntErr failed")
}
r, _ = PMapStrIntErr(nil, []string{})
if len(r) > 0 {
t.Errorf("PMapStrInt failed")
}
_, err := PMapStrIntErr(someLogicStrIntErr, []string{"ten", "0"})
if err == nil {
t.Errorf("PMapStrIntErr failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapStrIntErr(someLogicStrIntErr, []string{"0", "0", "ten"}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapStrIntErr failed")
}
_, err = PMapStrIntErr(someLogicStrIntErr, []string{"0", "0", "ten"}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapStrIntErr failed")
}
_, err = PMapStrIntErr(someLogicStrIntErr, []string{"0", "ten", "0"}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapStrIntErr failed")
}
_, err = PMapStrIntErr(someLogicStrIntErr, []string{"ten", "ten", "0"}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapStrIntErr failed")
}
expectedList = []int{10, 10}
newList, _ = PMapStrIntErr(someLogicStrIntErr, []string{"ten", "ten"}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapStrInt failed")
}
_, err = PMapStrIntErr(someLogicStrIntErr, []string{"ten", "ten", "0"}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrIntErr failed")
}
_, err = PMapStrIntErr(someLogicStrIntErr, []string{"ten", "ten", "0"}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrIntErr failed")
}
_, err = PMapStrIntErr(someLogicStrIntErr, []string{"0", "0", "ten"}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrIntErr failed")
}
_, err = PMapStrIntErr(someLogicStrIntErr, []string{"0", "ten", "0"}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrIntErr failed")
}
_, err = PMapStrIntErr(someLogicStrIntErr, []string{"ten", "ten", "0"}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrIntErr failed")
}
}
func TestPmapStrInt64Err(t *testing.T) {
// Test : someLogic
expectedList := []int64{10}
newList, _ := PMapStrInt64Err(someLogicStrInt64Err, []string{"ten"})
if newList[0] != expectedList[0] {
t.Errorf("PMapStrInt64Err failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapStrInt64Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapStrInt64Err failed")
}
r, _ = PMapStrInt64Err(nil, []string{})
if len(r) > 0 {
t.Errorf("PMapStrInt64 failed")
}
_, err := PMapStrInt64Err(someLogicStrInt64Err, []string{"ten", "0"})
if err == nil {
t.Errorf("PMapStrInt64Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapStrInt64Err(someLogicStrInt64Err, []string{"0", "0", "ten"}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapStrInt64Err failed")
}
_, err = PMapStrInt64Err(someLogicStrInt64Err, []string{"0", "0", "ten"}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapStrInt64Err failed")
}
_, err = PMapStrInt64Err(someLogicStrInt64Err, []string{"0", "ten", "0"}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapStrInt64Err failed")
}
_, err = PMapStrInt64Err(someLogicStrInt64Err, []string{"ten", "ten", "0"}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapStrInt64Err failed")
}
expectedList = []int64{10, 10}
newList, _ = PMapStrInt64Err(someLogicStrInt64Err, []string{"ten", "ten"}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapStrInt64 failed")
}
_, err = PMapStrInt64Err(someLogicStrInt64Err, []string{"ten", "ten", "0"}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrInt64Err failed")
}
_, err = PMapStrInt64Err(someLogicStrInt64Err, []string{"ten", "ten", "0"}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrInt64Err failed")
}
_, err = PMapStrInt64Err(someLogicStrInt64Err, []string{"0", "0", "ten"}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrInt64Err failed")
}
_, err = PMapStrInt64Err(someLogicStrInt64Err, []string{"0", "ten", "0"}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrInt64Err failed")
}
_, err = PMapStrInt64Err(someLogicStrInt64Err, []string{"ten", "ten", "0"}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrInt64Err failed")
}
}
func TestPmapStrInt32Err(t *testing.T) {
// Test : someLogic
expectedList := []int32{10}
newList, _ := PMapStrInt32Err(someLogicStrInt32Err, []string{"ten"})
if newList[0] != expectedList[0] {
t.Errorf("PMapStrInt32Err failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapStrInt32Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapStrInt32Err failed")
}
r, _ = PMapStrInt32Err(nil, []string{})
if len(r) > 0 {
t.Errorf("PMapStrInt32 failed")
}
_, err := PMapStrInt32Err(someLogicStrInt32Err, []string{"ten", "0"})
if err == nil {
t.Errorf("PMapStrInt32Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapStrInt32Err(someLogicStrInt32Err, []string{"0", "0", "ten"}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapStrInt32Err failed")
}
_, err = PMapStrInt32Err(someLogicStrInt32Err, []string{"0", "0", "ten"}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapStrInt32Err failed")
}
_, err = PMapStrInt32Err(someLogicStrInt32Err, []string{"0", "ten", "0"}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapStrInt32Err failed")
}
_, err = PMapStrInt32Err(someLogicStrInt32Err, []string{"ten", "ten", "0"}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapStrInt32Err failed")
}
expectedList = []int32{10, 10}
newList, _ = PMapStrInt32Err(someLogicStrInt32Err, []string{"ten", "ten"}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapStrInt32 failed")
}
_, err = PMapStrInt32Err(someLogicStrInt32Err, []string{"ten", "ten", "0"}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrInt32Err failed")
}
_, err = PMapStrInt32Err(someLogicStrInt32Err, []string{"ten", "ten", "0"}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrInt32Err failed")
}
_, err = PMapStrInt32Err(someLogicStrInt32Err, []string{"0", "0", "ten"}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrInt32Err failed")
}
_, err = PMapStrInt32Err(someLogicStrInt32Err, []string{"0", "ten", "0"}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrInt32Err failed")
}
_, err = PMapStrInt32Err(someLogicStrInt32Err, []string{"ten", "ten", "0"}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrInt32Err failed")
}
}
func TestPmapStrInt16Err(t *testing.T) {
// Test : someLogic
expectedList := []int16{10}
newList, _ := PMapStrInt16Err(someLogicStrInt16Err, []string{"ten"})
if newList[0] != expectedList[0] {
t.Errorf("PMapStrInt16Err failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapStrInt16Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapStrInt16Err failed")
}
r, _ = PMapStrInt16Err(nil, []string{})
if len(r) > 0 {
t.Errorf("PMapStrInt16 failed")
}
_, err := PMapStrInt16Err(someLogicStrInt16Err, []string{"ten", "0"})
if err == nil {
t.Errorf("PMapStrInt16Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapStrInt16Err(someLogicStrInt16Err, []string{"0", "0", "ten"}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapStrInt16Err failed")
}
_, err = PMapStrInt16Err(someLogicStrInt16Err, []string{"0", "0", "ten"}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapStrInt16Err failed")
}
_, err = PMapStrInt16Err(someLogicStrInt16Err, []string{"0", "ten", "0"}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapStrInt16Err failed")
}
_, err = PMapStrInt16Err(someLogicStrInt16Err, []string{"ten", "ten", "0"}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapStrInt16Err failed")
}
expectedList = []int16{10, 10}
newList, _ = PMapStrInt16Err(someLogicStrInt16Err, []string{"ten", "ten"}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapStrInt16 failed")
}
_, err = PMapStrInt16Err(someLogicStrInt16Err, []string{"ten", "ten", "0"}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrInt16Err failed")
}
_, err = PMapStrInt16Err(someLogicStrInt16Err, []string{"ten", "ten", "0"}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrInt16Err failed")
}
_, err = PMapStrInt16Err(someLogicStrInt16Err, []string{"0", "0", "ten"}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrInt16Err failed")
}
_, err = PMapStrInt16Err(someLogicStrInt16Err, []string{"0", "ten", "0"}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrInt16Err failed")
}
_, err = PMapStrInt16Err(someLogicStrInt16Err, []string{"ten", "ten", "0"}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrInt16Err failed")
}
}
func TestPmapStrInt8Err(t *testing.T) {
// Test : someLogic
expectedList := []int8{10}
newList, _ := PMapStrInt8Err(someLogicStrInt8Err, []string{"ten"})
if newList[0] != expectedList[0] {
t.Errorf("PMapStrInt8Err failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapStrInt8Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapStrInt8Err failed")
}
r, _ = PMapStrInt8Err(nil, []string{})
if len(r) > 0 {
t.Errorf("PMapStrInt8 failed")
}
_, err := PMapStrInt8Err(someLogicStrInt8Err, []string{"ten", "0"})
if err == nil {
t.Errorf("PMapStrInt8Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapStrInt8Err(someLogicStrInt8Err, []string{"0", "0", "ten"}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapStrInt8Err failed")
}
_, err = PMapStrInt8Err(someLogicStrInt8Err, []string{"0", "0", "ten"}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapStrInt8Err failed")
}
_, err = PMapStrInt8Err(someLogicStrInt8Err, []string{"0", "ten", "0"}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapStrInt8Err failed")
}
_, err = PMapStrInt8Err(someLogicStrInt8Err, []string{"ten", "ten", "0"}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapStrInt8Err failed")
}
expectedList = []int8{10, 10}
newList, _ = PMapStrInt8Err(someLogicStrInt8Err, []string{"ten", "ten"}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapStrInt8 failed")
}
_, err = PMapStrInt8Err(someLogicStrInt8Err, []string{"ten", "ten", "0"}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrInt8Err failed")
}
_, err = PMapStrInt8Err(someLogicStrInt8Err, []string{"ten", "ten", "0"}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrInt8Err failed")
}
_, err = PMapStrInt8Err(someLogicStrInt8Err, []string{"0", "0", "ten"}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrInt8Err failed")
}
_, err = PMapStrInt8Err(someLogicStrInt8Err, []string{"0", "ten", "0"}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrInt8Err failed")
}
_, err = PMapStrInt8Err(someLogicStrInt8Err, []string{"ten", "ten", "0"}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrInt8Err failed")
}
}
func TestPmapStrUintErr(t *testing.T) {
// Test : someLogic
expectedList := []uint{10}
newList, _ := PMapStrUintErr(someLogicStrUintErr, []string{"ten"})
if newList[0] != expectedList[0] {
t.Errorf("PMapStrUintErr failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapStrUintErr(nil, nil)
if len(r) > 0 {
t.Errorf("PMapStrUintErr failed")
}
r, _ = PMapStrUintErr(nil, []string{})
if len(r) > 0 {
t.Errorf("PMapStrUint failed")
}
_, err := PMapStrUintErr(someLogicStrUintErr, []string{"ten", "0"})
if err == nil {
t.Errorf("PMapStrUintErr failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapStrUintErr(someLogicStrUintErr, []string{"0", "0", "ten"}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapStrUintErr failed")
}
_, err = PMapStrUintErr(someLogicStrUintErr, []string{"0", "0", "ten"}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapStrUintErr failed")
}
_, err = PMapStrUintErr(someLogicStrUintErr, []string{"0", "ten", "0"}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapStrUintErr failed")
}
_, err = PMapStrUintErr(someLogicStrUintErr, []string{"ten", "ten", "0"}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapStrUintErr failed")
}
expectedList = []uint{10, 10}
newList, _ = PMapStrUintErr(someLogicStrUintErr, []string{"ten", "ten"}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapStrUint failed")
}
_, err = PMapStrUintErr(someLogicStrUintErr, []string{"ten", "ten", "0"}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrUintErr failed")
}
_, err = PMapStrUintErr(someLogicStrUintErr, []string{"ten", "ten", "0"}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrUintErr failed")
}
_, err = PMapStrUintErr(someLogicStrUintErr, []string{"0", "0", "ten"}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrUintErr failed")
}
_, err = PMapStrUintErr(someLogicStrUintErr, []string{"0", "ten", "0"}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrUintErr failed")
}
_, err = PMapStrUintErr(someLogicStrUintErr, []string{"ten", "ten", "0"}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrUintErr failed")
}
}
func TestPmapStrUint64Err(t *testing.T) {
// Test : someLogic
expectedList := []uint64{10}
newList, _ := PMapStrUint64Err(someLogicStrUint64Err, []string{"ten"})
if newList[0] != expectedList[0] {
t.Errorf("PMapStrUint64Err failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapStrUint64Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapStrUint64Err failed")
}
r, _ = PMapStrUint64Err(nil, []string{})
if len(r) > 0 {
t.Errorf("PMapStrUint64 failed")
}
_, err := PMapStrUint64Err(someLogicStrUint64Err, []string{"ten", "0"})
if err == nil {
t.Errorf("PMapStrUint64Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapStrUint64Err(someLogicStrUint64Err, []string{"0", "0", "ten"}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapStrUint64Err failed")
}
_, err = PMapStrUint64Err(someLogicStrUint64Err, []string{"0", "0", "ten"}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapStrUint64Err failed")
}
_, err = PMapStrUint64Err(someLogicStrUint64Err, []string{"0", "ten", "0"}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapStrUint64Err failed")
}
_, err = PMapStrUint64Err(someLogicStrUint64Err, []string{"ten", "ten", "0"}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapStrUint64Err failed")
}
expectedList = []uint64{10, 10}
newList, _ = PMapStrUint64Err(someLogicStrUint64Err, []string{"ten", "ten"}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapStrUint64 failed")
}
_, err = PMapStrUint64Err(someLogicStrUint64Err, []string{"ten", "ten", "0"}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrUint64Err failed")
}
_, err = PMapStrUint64Err(someLogicStrUint64Err, []string{"ten", "ten", "0"}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrUint64Err failed")
}
_, err = PMapStrUint64Err(someLogicStrUint64Err, []string{"0", "0", "ten"}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrUint64Err failed")
}
_, err = PMapStrUint64Err(someLogicStrUint64Err, []string{"0", "ten", "0"}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrUint64Err failed")
}
_, err = PMapStrUint64Err(someLogicStrUint64Err, []string{"ten", "ten", "0"}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrUint64Err failed")
}
}
func TestPmapStrUint32Err(t *testing.T) {
// Test : someLogic
expectedList := []uint32{10}
newList, _ := PMapStrUint32Err(someLogicStrUint32Err, []string{"ten"})
if newList[0] != expectedList[0] {
t.Errorf("PMapStrUint32Err failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapStrUint32Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapStrUint32Err failed")
}
r, _ = PMapStrUint32Err(nil, []string{})
if len(r) > 0 {
t.Errorf("PMapStrUint32 failed")
}
_, err := PMapStrUint32Err(someLogicStrUint32Err, []string{"ten", "0"})
if err == nil {
t.Errorf("PMapStrUint32Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapStrUint32Err(someLogicStrUint32Err, []string{"0", "0", "ten"}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapStrUint32Err failed")
}
_, err = PMapStrUint32Err(someLogicStrUint32Err, []string{"0", "0", "ten"}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapStrUint32Err failed")
}
_, err = PMapStrUint32Err(someLogicStrUint32Err, []string{"0", "ten", "0"}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapStrUint32Err failed")
}
_, err = PMapStrUint32Err(someLogicStrUint32Err, []string{"ten", "ten", "0"}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapStrUint32Err failed")
}
expectedList = []uint32{10, 10}
newList, _ = PMapStrUint32Err(someLogicStrUint32Err, []string{"ten", "ten"}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapStrUint32 failed")
}
_, err = PMapStrUint32Err(someLogicStrUint32Err, []string{"ten", "ten", "0"}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrUint32Err failed")
}
_, err = PMapStrUint32Err(someLogicStrUint32Err, []string{"ten", "ten", "0"}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrUint32Err failed")
}
_, err = PMapStrUint32Err(someLogicStrUint32Err, []string{"0", "0", "ten"}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrUint32Err failed")
}
_, err = PMapStrUint32Err(someLogicStrUint32Err, []string{"0", "ten", "0"}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrUint32Err failed")
}
_, err = PMapStrUint32Err(someLogicStrUint32Err, []string{"ten", "ten", "0"}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrUint32Err failed")
}
}
func TestPmapStrUint16Err(t *testing.T) {
// Test : someLogic
expectedList := []uint16{10}
newList, _ := PMapStrUint16Err(someLogicStrUint16Err, []string{"ten"})
if newList[0] != expectedList[0] {
t.Errorf("PMapStrUint16Err failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapStrUint16Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapStrUint16Err failed")
}
r, _ = PMapStrUint16Err(nil, []string{})
if len(r) > 0 {
t.Errorf("PMapStrUint16 failed")
}
_, err := PMapStrUint16Err(someLogicStrUint16Err, []string{"ten", "0"})
if err == nil {
t.Errorf("PMapStrUint16Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapStrUint16Err(someLogicStrUint16Err, []string{"0", "0", "ten"}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapStrUint16Err failed")
}
_, err = PMapStrUint16Err(someLogicStrUint16Err, []string{"0", "0", "ten"}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapStrUint16Err failed")
}
_, err = PMapStrUint16Err(someLogicStrUint16Err, []string{"0", "ten", "0"}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapStrUint16Err failed")
}
_, err = PMapStrUint16Err(someLogicStrUint16Err, []string{"ten", "ten", "0"}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapStrUint16Err failed")
}
expectedList = []uint16{10, 10}
newList, _ = PMapStrUint16Err(someLogicStrUint16Err, []string{"ten", "ten"}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapStrUint16 failed")
}
_, err = PMapStrUint16Err(someLogicStrUint16Err, []string{"ten", "ten", "0"}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrUint16Err failed")
}
_, err = PMapStrUint16Err(someLogicStrUint16Err, []string{"ten", "ten", "0"}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrUint16Err failed")
}
_, err = PMapStrUint16Err(someLogicStrUint16Err, []string{"0", "0", "ten"}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrUint16Err failed")
}
_, err = PMapStrUint16Err(someLogicStrUint16Err, []string{"0", "ten", "0"}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrUint16Err failed")
}
_, err = PMapStrUint16Err(someLogicStrUint16Err, []string{"ten", "ten", "0"}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrUint16Err failed")
}
}
func TestPmapStrUint8Err(t *testing.T) {
// Test : someLogic
expectedList := []uint8{10}
newList, _ := PMapStrUint8Err(someLogicStrUint8Err, []string{"ten"})
if newList[0] != expectedList[0] {
t.Errorf("PMapStrUint8Err failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapStrUint8Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapStrUint8Err failed")
}
r, _ = PMapStrUint8Err(nil, []string{})
if len(r) > 0 {
t.Errorf("PMapStrUint8 failed")
}
_, err := PMapStrUint8Err(someLogicStrUint8Err, []string{"ten", "0"})
if err == nil {
t.Errorf("PMapStrUint8Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapStrUint8Err(someLogicStrUint8Err, []string{"0", "0", "ten"}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapStrUint8Err failed")
}
_, err = PMapStrUint8Err(someLogicStrUint8Err, []string{"0", "0", "ten"}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapStrUint8Err failed")
}
_, err = PMapStrUint8Err(someLogicStrUint8Err, []string{"0", "ten", "0"}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapStrUint8Err failed")
}
_, err = PMapStrUint8Err(someLogicStrUint8Err, []string{"ten", "ten", "0"}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapStrUint8Err failed")
}
expectedList = []uint8{10, 10}
newList, _ = PMapStrUint8Err(someLogicStrUint8Err, []string{"ten", "ten"}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapStrUint8 failed")
}
_, err = PMapStrUint8Err(someLogicStrUint8Err, []string{"ten", "ten", "0"}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrUint8Err failed")
}
_, err = PMapStrUint8Err(someLogicStrUint8Err, []string{"ten", "ten", "0"}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrUint8Err failed")
}
_, err = PMapStrUint8Err(someLogicStrUint8Err, []string{"0", "0", "ten"}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrUint8Err failed")
}
_, err = PMapStrUint8Err(someLogicStrUint8Err, []string{"0", "ten", "0"}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrUint8Err failed")
}
_, err = PMapStrUint8Err(someLogicStrUint8Err, []string{"ten", "ten", "0"}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrUint8Err failed")
}
}
func TestPmapStrBoolErr(t *testing.T) {
// Test : someLogic
expectedList := []bool{true, false}
newList, _ := PMapStrBoolErr(someLogicStrBoolErr, []string{"10", "0"})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapStrBoolErr failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapStrBoolErr(nil, nil)
if len(r) > 0 {
t.Errorf("PMapStrBoolErr failed")
}
r, _ = PMapStrBoolErr(nil, []string{})
if len(r) > 0 {
t.Errorf("PMapStrBoolErr failed")
}
_, err := PMapStrBoolErr(someLogicStrBoolErr, []string{"10", "0", "3"})
if err == nil {
t.Errorf("PMapStrBoolErr failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapStrBoolErr(someLogicStrBoolErr, []string{"10", "10", "3"}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapStrBoolErr failed")
}
_, err = PMapStrBoolErr(someLogicStrBoolErr, []string{"3", "3", "10"}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapStrBoolErr failed")
}
_, err = PMapStrBoolErr(someLogicStrBoolErr, []string{"3", "10", "3"}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapStrBoolErr failed")
}
_, err = PMapStrBoolErr(someLogicStrBoolErr, []string{"10", "10", "3"}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapStrBoolErr failed")
}
expectedList = []bool{true, true}
newList, _ = PMapStrBoolErr(someLogicStrBoolErr, []string{"10", "10"}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapStrBool failed")
}
_, err = PMapStrBoolErr(someLogicStrBoolErr, []string{"10", "10", "3"}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrBoolErr failed")
}
_, err = PMapStrBoolErr(someLogicStrBoolErr, []string{"10", "10", "3"}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrBoolErr failed")
}
_, err = PMapStrBoolErr(someLogicStrBoolErr, []string{"3", "3", "10"}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrBoolErr failed")
}
_, err = PMapStrBoolErr(someLogicStrBoolErr, []string{"3", "10", "3"}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrBoolErr failed")
}
_, err = PMapStrBoolErr(someLogicStrBoolErr, []string{"10", "10", "3"}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrBoolErr failed")
}
}
func TestPmapStrFloat32Err(t *testing.T) {
// Test : someLogic
expectedList := []float32{10}
newList, _ := PMapStrFloat32Err(someLogicStrFloat32Err, []string{"ten"})
if newList[0] != expectedList[0] {
t.Errorf("PMapStrFloat32Err failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapStrFloat32Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapStrFloat32Err failed")
}
r, _ = PMapStrFloat32Err(nil, []string{})
if len(r) > 0 {
t.Errorf("PMapStrFloat32 failed")
}
_, err := PMapStrFloat32Err(someLogicStrFloat32Err, []string{"ten", "0"})
if err == nil {
t.Errorf("PMapStrFloat32Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapStrFloat32Err(someLogicStrFloat32Err, []string{"0", "0", "ten"}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapStrFloat32Err failed")
}
_, err = PMapStrFloat32Err(someLogicStrFloat32Err, []string{"0", "0", "ten"}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapStrFloat32Err failed")
}
_, err = PMapStrFloat32Err(someLogicStrFloat32Err, []string{"0", "ten", "0"}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapStrFloat32Err failed")
}
_, err = PMapStrFloat32Err(someLogicStrFloat32Err, []string{"ten", "ten", "0"}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapStrFloat32Err failed")
}
expectedList = []float32{10, 10}
newList, _ = PMapStrFloat32Err(someLogicStrFloat32Err, []string{"ten", "ten"}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapStrFloat32 failed")
}
_, err = PMapStrFloat32Err(someLogicStrFloat32Err, []string{"ten", "ten", "0"}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrFloat32Err failed")
}
_, err = PMapStrFloat32Err(someLogicStrFloat32Err, []string{"ten", "ten", "0"}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrFloat32Err failed")
}
_, err = PMapStrFloat32Err(someLogicStrFloat32Err, []string{"0", "0", "ten"}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrFloat32Err failed")
}
_, err = PMapStrFloat32Err(someLogicStrFloat32Err, []string{"0", "ten", "0"}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrFloat32Err failed")
}
_, err = PMapStrFloat32Err(someLogicStrFloat32Err, []string{"ten", "ten", "0"}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrFloat32Err failed")
}
}
func TestPmapStrFloat64Err(t *testing.T) {
// Test : someLogic
expectedList := []float64{10}
newList, _ := PMapStrFloat64Err(someLogicStrFloat64Err, []string{"ten"})
if newList[0] != expectedList[0] {
t.Errorf("PMapStrFloat64Err failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapStrFloat64Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapStrFloat64Err failed")
}
r, _ = PMapStrFloat64Err(nil, []string{})
if len(r) > 0 {
t.Errorf("PMapStrFloat64 failed")
}
_, err := PMapStrFloat64Err(someLogicStrFloat64Err, []string{"ten", "0"})
if err == nil {
t.Errorf("PMapStrFloat64Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapStrFloat64Err(someLogicStrFloat64Err, []string{"0", "0", "ten"}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapStrFloat64Err failed")
}
_, err = PMapStrFloat64Err(someLogicStrFloat64Err, []string{"0", "0", "ten"}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapStrFloat64Err failed")
}
_, err = PMapStrFloat64Err(someLogicStrFloat64Err, []string{"0", "ten", "0"}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapStrFloat64Err failed")
}
_, err = PMapStrFloat64Err(someLogicStrFloat64Err, []string{"ten", "ten", "0"}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapStrFloat64Err failed")
}
expectedList = []float64{10, 10}
newList, _ = PMapStrFloat64Err(someLogicStrFloat64Err, []string{"ten", "ten"}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapStrFloat64 failed")
}
_, err = PMapStrFloat64Err(someLogicStrFloat64Err, []string{"ten", "ten", "0"}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrFloat64Err failed")
}
_, err = PMapStrFloat64Err(someLogicStrFloat64Err, []string{"ten", "ten", "0"}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrFloat64Err failed")
}
_, err = PMapStrFloat64Err(someLogicStrFloat64Err, []string{"0", "0", "ten"}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrFloat64Err failed")
}
_, err = PMapStrFloat64Err(someLogicStrFloat64Err, []string{"0", "ten", "0"}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrFloat64Err failed")
}
_, err = PMapStrFloat64Err(someLogicStrFloat64Err, []string{"ten", "ten", "0"}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapStrFloat64Err failed")
}
}
func TestPmapBoolIntErr(t *testing.T) {
// Test : someLogic
expectedList := []int{10, 10}
newList, _ := PMapBoolIntErr(someLogicBoolIntErr, []bool{true, true})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapBoolIntErr failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapBoolIntErr(nil, nil)
if len(r) > 0 {
t.Errorf("PMapBoolIntErr failed")
}
r, _ = PMapBoolIntErr(nil, []bool{})
if len(r) > 0 {
t.Errorf("PMapBoolIntErr failed")
}
_, err := PMapBoolIntErr(someLogicBoolIntErr, []bool{true, false})
if err == nil {
t.Errorf("PMapBoolIntErr failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapBoolIntErr(someLogicBoolIntErr, []bool{true, true, false}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapBoolIntErr failed")
}
_, err = PMapBoolIntErr(someLogicBoolIntErr, []bool{false, false, true}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapBoolIntErr failed")
}
_, err = PMapBoolIntErr(someLogicBoolIntErr, []bool{false, true, false}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapBoolIntErr failed")
}
_, err = PMapBoolIntErr(someLogicBoolIntErr, []bool{true, true, false}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapBoolIntErr failed")
}
expectedList = []int{10, 10}
newList, _ = PMapBoolIntErr(someLogicBoolIntErr, []bool{true, true}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapBoolInt failed")
}
_, err = PMapBoolIntErr(someLogicBoolIntErr, []bool{true, true, false}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolIntErr failed")
}
_, err = PMapBoolIntErr(someLogicBoolIntErr, []bool{true, true, false}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolIntErr failed")
}
_, err = PMapBoolIntErr(someLogicBoolIntErr, []bool{false, false, true}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolIntErr failed")
}
_, err = PMapBoolIntErr(someLogicBoolIntErr, []bool{false, true, false}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolIntErr failed")
}
_, err = PMapBoolIntErr(someLogicBoolIntErr, []bool{true, true, false}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolIntErr failed")
}
}
func TestPmapBoolInt64Err(t *testing.T) {
// Test : someLogic
expectedList := []int64{10, 10}
newList, _ := PMapBoolInt64Err(someLogicBoolInt64Err, []bool{true, true})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapBoolInt64Err failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapBoolInt64Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapBoolInt64Err failed")
}
r, _ = PMapBoolInt64Err(nil, []bool{})
if len(r) > 0 {
t.Errorf("PMapBoolInt64Err failed")
}
_, err := PMapBoolInt64Err(someLogicBoolInt64Err, []bool{true, false})
if err == nil {
t.Errorf("PMapBoolInt64Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapBoolInt64Err(someLogicBoolInt64Err, []bool{true, true, false}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapBoolInt64Err failed")
}
_, err = PMapBoolInt64Err(someLogicBoolInt64Err, []bool{false, false, true}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapBoolInt64Err failed")
}
_, err = PMapBoolInt64Err(someLogicBoolInt64Err, []bool{false, true, false}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapBoolInt64Err failed")
}
_, err = PMapBoolInt64Err(someLogicBoolInt64Err, []bool{true, true, false}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapBoolInt64Err failed")
}
expectedList = []int64{10, 10}
newList, _ = PMapBoolInt64Err(someLogicBoolInt64Err, []bool{true, true}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapBoolInt64 failed")
}
_, err = PMapBoolInt64Err(someLogicBoolInt64Err, []bool{true, true, false}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolInt64Err failed")
}
_, err = PMapBoolInt64Err(someLogicBoolInt64Err, []bool{true, true, false}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolInt64Err failed")
}
_, err = PMapBoolInt64Err(someLogicBoolInt64Err, []bool{false, false, true}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolInt64Err failed")
}
_, err = PMapBoolInt64Err(someLogicBoolInt64Err, []bool{false, true, false}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolInt64Err failed")
}
_, err = PMapBoolInt64Err(someLogicBoolInt64Err, []bool{true, true, false}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolInt64Err failed")
}
}
func TestPmapBoolInt32Err(t *testing.T) {
// Test : someLogic
expectedList := []int32{10, 10}
newList, _ := PMapBoolInt32Err(someLogicBoolInt32Err, []bool{true, true})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapBoolInt32Err failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapBoolInt32Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapBoolInt32Err failed")
}
r, _ = PMapBoolInt32Err(nil, []bool{})
if len(r) > 0 {
t.Errorf("PMapBoolInt32Err failed")
}
_, err := PMapBoolInt32Err(someLogicBoolInt32Err, []bool{true, false})
if err == nil {
t.Errorf("PMapBoolInt32Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapBoolInt32Err(someLogicBoolInt32Err, []bool{true, true, false}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapBoolInt32Err failed")
}
_, err = PMapBoolInt32Err(someLogicBoolInt32Err, []bool{false, false, true}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapBoolInt32Err failed")
}
_, err = PMapBoolInt32Err(someLogicBoolInt32Err, []bool{false, true, false}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapBoolInt32Err failed")
}
_, err = PMapBoolInt32Err(someLogicBoolInt32Err, []bool{true, true, false}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapBoolInt32Err failed")
}
expectedList = []int32{10, 10}
newList, _ = PMapBoolInt32Err(someLogicBoolInt32Err, []bool{true, true}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapBoolInt32 failed")
}
_, err = PMapBoolInt32Err(someLogicBoolInt32Err, []bool{true, true, false}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolInt32Err failed")
}
_, err = PMapBoolInt32Err(someLogicBoolInt32Err, []bool{true, true, false}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolInt32Err failed")
}
_, err = PMapBoolInt32Err(someLogicBoolInt32Err, []bool{false, false, true}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolInt32Err failed")
}
_, err = PMapBoolInt32Err(someLogicBoolInt32Err, []bool{false, true, false}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolInt32Err failed")
}
_, err = PMapBoolInt32Err(someLogicBoolInt32Err, []bool{true, true, false}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolInt32Err failed")
}
}
func TestPmapBoolInt16Err(t *testing.T) {
// Test : someLogic
expectedList := []int16{10, 10}
newList, _ := PMapBoolInt16Err(someLogicBoolInt16Err, []bool{true, true})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapBoolInt16Err failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapBoolInt16Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapBoolInt16Err failed")
}
r, _ = PMapBoolInt16Err(nil, []bool{})
if len(r) > 0 {
t.Errorf("PMapBoolInt16Err failed")
}
_, err := PMapBoolInt16Err(someLogicBoolInt16Err, []bool{true, false})
if err == nil {
t.Errorf("PMapBoolInt16Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapBoolInt16Err(someLogicBoolInt16Err, []bool{true, true, false}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapBoolInt16Err failed")
}
_, err = PMapBoolInt16Err(someLogicBoolInt16Err, []bool{false, false, true}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapBoolInt16Err failed")
}
_, err = PMapBoolInt16Err(someLogicBoolInt16Err, []bool{false, true, false}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapBoolInt16Err failed")
}
_, err = PMapBoolInt16Err(someLogicBoolInt16Err, []bool{true, true, false}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapBoolInt16Err failed")
}
expectedList = []int16{10, 10}
newList, _ = PMapBoolInt16Err(someLogicBoolInt16Err, []bool{true, true}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapBoolInt16 failed")
}
_, err = PMapBoolInt16Err(someLogicBoolInt16Err, []bool{true, true, false}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolInt16Err failed")
}
_, err = PMapBoolInt16Err(someLogicBoolInt16Err, []bool{true, true, false}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolInt16Err failed")
}
_, err = PMapBoolInt16Err(someLogicBoolInt16Err, []bool{false, false, true}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolInt16Err failed")
}
_, err = PMapBoolInt16Err(someLogicBoolInt16Err, []bool{false, true, false}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolInt16Err failed")
}
_, err = PMapBoolInt16Err(someLogicBoolInt16Err, []bool{true, true, false}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolInt16Err failed")
}
}
func TestPmapBoolInt8Err(t *testing.T) {
// Test : someLogic
expectedList := []int8{10, 10}
newList, _ := PMapBoolInt8Err(someLogicBoolInt8Err, []bool{true, true})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapBoolInt8Err failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapBoolInt8Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapBoolInt8Err failed")
}
r, _ = PMapBoolInt8Err(nil, []bool{})
if len(r) > 0 {
t.Errorf("PMapBoolInt8Err failed")
}
_, err := PMapBoolInt8Err(someLogicBoolInt8Err, []bool{true, false})
if err == nil {
t.Errorf("PMapBoolInt8Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapBoolInt8Err(someLogicBoolInt8Err, []bool{true, true, false}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapBoolInt8Err failed")
}
_, err = PMapBoolInt8Err(someLogicBoolInt8Err, []bool{false, false, true}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapBoolInt8Err failed")
}
_, err = PMapBoolInt8Err(someLogicBoolInt8Err, []bool{false, true, false}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapBoolInt8Err failed")
}
_, err = PMapBoolInt8Err(someLogicBoolInt8Err, []bool{true, true, false}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapBoolInt8Err failed")
}
expectedList = []int8{10, 10}
newList, _ = PMapBoolInt8Err(someLogicBoolInt8Err, []bool{true, true}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapBoolInt8 failed")
}
_, err = PMapBoolInt8Err(someLogicBoolInt8Err, []bool{true, true, false}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolInt8Err failed")
}
_, err = PMapBoolInt8Err(someLogicBoolInt8Err, []bool{true, true, false}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolInt8Err failed")
}
_, err = PMapBoolInt8Err(someLogicBoolInt8Err, []bool{false, false, true}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolInt8Err failed")
}
_, err = PMapBoolInt8Err(someLogicBoolInt8Err, []bool{false, true, false}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolInt8Err failed")
}
_, err = PMapBoolInt8Err(someLogicBoolInt8Err, []bool{true, true, false}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolInt8Err failed")
}
}
func TestPmapBoolUintErr(t *testing.T) {
// Test : someLogic
expectedList := []uint{10, 10}
newList, _ := PMapBoolUintErr(someLogicBoolUintErr, []bool{true, true})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapBoolUintErr failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapBoolUintErr(nil, nil)
if len(r) > 0 {
t.Errorf("PMapBoolUintErr failed")
}
r, _ = PMapBoolUintErr(nil, []bool{})
if len(r) > 0 {
t.Errorf("PMapBoolUintErr failed")
}
_, err := PMapBoolUintErr(someLogicBoolUintErr, []bool{true, false})
if err == nil {
t.Errorf("PMapBoolUintErr failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapBoolUintErr(someLogicBoolUintErr, []bool{true, true, false}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapBoolUintErr failed")
}
_, err = PMapBoolUintErr(someLogicBoolUintErr, []bool{false, false, true}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapBoolUintErr failed")
}
_, err = PMapBoolUintErr(someLogicBoolUintErr, []bool{false, true, false}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapBoolUintErr failed")
}
_, err = PMapBoolUintErr(someLogicBoolUintErr, []bool{true, true, false}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapBoolUintErr failed")
}
expectedList = []uint{10, 10}
newList, _ = PMapBoolUintErr(someLogicBoolUintErr, []bool{true, true}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapBoolUint failed")
}
_, err = PMapBoolUintErr(someLogicBoolUintErr, []bool{true, true, false}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolUintErr failed")
}
_, err = PMapBoolUintErr(someLogicBoolUintErr, []bool{true, true, false}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolUintErr failed")
}
_, err = PMapBoolUintErr(someLogicBoolUintErr, []bool{false, false, true}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolUintErr failed")
}
_, err = PMapBoolUintErr(someLogicBoolUintErr, []bool{false, true, false}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolUintErr failed")
}
_, err = PMapBoolUintErr(someLogicBoolUintErr, []bool{true, true, false}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolUintErr failed")
}
}
func TestPmapBoolUint64Err(t *testing.T) {
// Test : someLogic
expectedList := []uint64{10, 10}
newList, _ := PMapBoolUint64Err(someLogicBoolUint64Err, []bool{true, true})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapBoolUint64Err failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapBoolUint64Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapBoolUint64Err failed")
}
r, _ = PMapBoolUint64Err(nil, []bool{})
if len(r) > 0 {
t.Errorf("PMapBoolUint64Err failed")
}
_, err := PMapBoolUint64Err(someLogicBoolUint64Err, []bool{true, false})
if err == nil {
t.Errorf("PMapBoolUint64Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapBoolUint64Err(someLogicBoolUint64Err, []bool{true, true, false}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapBoolUint64Err failed")
}
_, err = PMapBoolUint64Err(someLogicBoolUint64Err, []bool{false, false, true}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapBoolUint64Err failed")
}
_, err = PMapBoolUint64Err(someLogicBoolUint64Err, []bool{false, true, false}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapBoolUint64Err failed")
}
_, err = PMapBoolUint64Err(someLogicBoolUint64Err, []bool{true, true, false}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapBoolUint64Err failed")
}
expectedList = []uint64{10, 10}
newList, _ = PMapBoolUint64Err(someLogicBoolUint64Err, []bool{true, true}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapBoolUint64 failed")
}
_, err = PMapBoolUint64Err(someLogicBoolUint64Err, []bool{true, true, false}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolUint64Err failed")
}
_, err = PMapBoolUint64Err(someLogicBoolUint64Err, []bool{true, true, false}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolUint64Err failed")
}
_, err = PMapBoolUint64Err(someLogicBoolUint64Err, []bool{false, false, true}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolUint64Err failed")
}
_, err = PMapBoolUint64Err(someLogicBoolUint64Err, []bool{false, true, false}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolUint64Err failed")
}
_, err = PMapBoolUint64Err(someLogicBoolUint64Err, []bool{true, true, false}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolUint64Err failed")
}
}
func TestPmapBoolUint32Err(t *testing.T) {
// Test : someLogic
expectedList := []uint32{10, 10}
newList, _ := PMapBoolUint32Err(someLogicBoolUint32Err, []bool{true, true})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapBoolUint32Err failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapBoolUint32Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapBoolUint32Err failed")
}
r, _ = PMapBoolUint32Err(nil, []bool{})
if len(r) > 0 {
t.Errorf("PMapBoolUint32Err failed")
}
_, err := PMapBoolUint32Err(someLogicBoolUint32Err, []bool{true, false})
if err == nil {
t.Errorf("PMapBoolUint32Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapBoolUint32Err(someLogicBoolUint32Err, []bool{true, true, false}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapBoolUint32Err failed")
}
_, err = PMapBoolUint32Err(someLogicBoolUint32Err, []bool{false, false, true}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapBoolUint32Err failed")
}
_, err = PMapBoolUint32Err(someLogicBoolUint32Err, []bool{false, true, false}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapBoolUint32Err failed")
}
_, err = PMapBoolUint32Err(someLogicBoolUint32Err, []bool{true, true, false}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapBoolUint32Err failed")
}
expectedList = []uint32{10, 10}
newList, _ = PMapBoolUint32Err(someLogicBoolUint32Err, []bool{true, true}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapBoolUint32 failed")
}
_, err = PMapBoolUint32Err(someLogicBoolUint32Err, []bool{true, true, false}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolUint32Err failed")
}
_, err = PMapBoolUint32Err(someLogicBoolUint32Err, []bool{true, true, false}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolUint32Err failed")
}
_, err = PMapBoolUint32Err(someLogicBoolUint32Err, []bool{false, false, true}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolUint32Err failed")
}
_, err = PMapBoolUint32Err(someLogicBoolUint32Err, []bool{false, true, false}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolUint32Err failed")
}
_, err = PMapBoolUint32Err(someLogicBoolUint32Err, []bool{true, true, false}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolUint32Err failed")
}
}
func TestPmapBoolUint16Err(t *testing.T) {
// Test : someLogic
expectedList := []uint16{10, 10}
newList, _ := PMapBoolUint16Err(someLogicBoolUint16Err, []bool{true, true})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapBoolUint16Err failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapBoolUint16Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapBoolUint16Err failed")
}
r, _ = PMapBoolUint16Err(nil, []bool{})
if len(r) > 0 {
t.Errorf("PMapBoolUint16Err failed")
}
_, err := PMapBoolUint16Err(someLogicBoolUint16Err, []bool{true, false})
if err == nil {
t.Errorf("PMapBoolUint16Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapBoolUint16Err(someLogicBoolUint16Err, []bool{true, true, false}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapBoolUint16Err failed")
}
_, err = PMapBoolUint16Err(someLogicBoolUint16Err, []bool{false, false, true}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapBoolUint16Err failed")
}
_, err = PMapBoolUint16Err(someLogicBoolUint16Err, []bool{false, true, false}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapBoolUint16Err failed")
}
_, err = PMapBoolUint16Err(someLogicBoolUint16Err, []bool{true, true, false}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapBoolUint16Err failed")
}
expectedList = []uint16{10, 10}
newList, _ = PMapBoolUint16Err(someLogicBoolUint16Err, []bool{true, true}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapBoolUint16 failed")
}
_, err = PMapBoolUint16Err(someLogicBoolUint16Err, []bool{true, true, false}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolUint16Err failed")
}
_, err = PMapBoolUint16Err(someLogicBoolUint16Err, []bool{true, true, false}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolUint16Err failed")
}
_, err = PMapBoolUint16Err(someLogicBoolUint16Err, []bool{false, false, true}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolUint16Err failed")
}
_, err = PMapBoolUint16Err(someLogicBoolUint16Err, []bool{false, true, false}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolUint16Err failed")
}
_, err = PMapBoolUint16Err(someLogicBoolUint16Err, []bool{true, true, false}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolUint16Err failed")
}
}
func TestPmapBoolUint8Err(t *testing.T) {
// Test : someLogic
expectedList := []uint8{10, 10}
newList, _ := PMapBoolUint8Err(someLogicBoolUint8Err, []bool{true, true})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapBoolUint8Err failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapBoolUint8Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapBoolUint8Err failed")
}
r, _ = PMapBoolUint8Err(nil, []bool{})
if len(r) > 0 {
t.Errorf("PMapBoolUint8Err failed")
}
_, err := PMapBoolUint8Err(someLogicBoolUint8Err, []bool{true, false})
if err == nil {
t.Errorf("PMapBoolUint8Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapBoolUint8Err(someLogicBoolUint8Err, []bool{true, true, false}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapBoolUint8Err failed")
}
_, err = PMapBoolUint8Err(someLogicBoolUint8Err, []bool{false, false, true}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapBoolUint8Err failed")
}
_, err = PMapBoolUint8Err(someLogicBoolUint8Err, []bool{false, true, false}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapBoolUint8Err failed")
}
_, err = PMapBoolUint8Err(someLogicBoolUint8Err, []bool{true, true, false}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapBoolUint8Err failed")
}
expectedList = []uint8{10, 10}
newList, _ = PMapBoolUint8Err(someLogicBoolUint8Err, []bool{true, true}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapBoolUint8 failed")
}
_, err = PMapBoolUint8Err(someLogicBoolUint8Err, []bool{true, true, false}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolUint8Err failed")
}
_, err = PMapBoolUint8Err(someLogicBoolUint8Err, []bool{true, true, false}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolUint8Err failed")
}
_, err = PMapBoolUint8Err(someLogicBoolUint8Err, []bool{false, false, true}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolUint8Err failed")
}
_, err = PMapBoolUint8Err(someLogicBoolUint8Err, []bool{false, true, false}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolUint8Err failed")
}
_, err = PMapBoolUint8Err(someLogicBoolUint8Err, []bool{true, true, false}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolUint8Err failed")
}
}
func TestPmapBoolStrErr(t *testing.T) {
// Test : someLogic
expectedList := []string{"10", "10"}
newList, _ := PMapBoolStrErr(someLogicBoolStrErr, []bool{true, true})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapBoolStrErr failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapBoolStrErr(nil, nil)
if len(r) > 0 {
t.Errorf("PMapBoolStrErr failed")
}
r, _ = PMapBoolStrErr(nil, []bool{})
if len(r) > 0 {
t.Errorf("PMapBoolStrErr failed")
}
_, err := PMapBoolStrErr(someLogicBoolStrErr, []bool{true, false})
if err == nil {
t.Errorf("PMapBoolStrErr failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapBoolStrErr(someLogicBoolStrErr, []bool{true, true, false}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapBoolStrErr failed")
}
_, err = PMapBoolStrErr(someLogicBoolStrErr, []bool{false, false, true}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapBoolStrErr failed")
}
_, err = PMapBoolStrErr(someLogicBoolStrErr, []bool{false, true, false}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapBoolStrErr failed")
}
_, err = PMapBoolStrErr(someLogicBoolStrErr, []bool{true, true, false}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapBoolStrErr failed")
}
expectedList = []string{"10", "10"}
newList, _ = PMapBoolStrErr(someLogicBoolStrErr, []bool{true, true}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapBoolStr failed")
}
_, err = PMapBoolStrErr(someLogicBoolStrErr, []bool{true, true, false}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolStrErr failed")
}
_, err = PMapBoolStrErr(someLogicBoolStrErr, []bool{true, true, false}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolStrErr failed")
}
_, err = PMapBoolStrErr(someLogicBoolStrErr, []bool{false, false, true}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolStrErr failed")
}
_, err = PMapBoolStrErr(someLogicBoolStrErr, []bool{false, true, false}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolStrErr failed")
}
_, err = PMapBoolStrErr(someLogicBoolStrErr, []bool{true, true, false}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolStrErr failed")
}
}
func TestPmapBoolFloat32Err(t *testing.T) {
// Test : someLogic
expectedList := []float32{10, 10}
newList, _ := PMapBoolFloat32Err(someLogicBoolFloat32Err, []bool{true, true})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapBoolFloat32Err failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapBoolFloat32Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapBoolFloat32Err failed")
}
r, _ = PMapBoolFloat32Err(nil, []bool{})
if len(r) > 0 {
t.Errorf("PMapBoolFloat32Err failed")
}
_, err := PMapBoolFloat32Err(someLogicBoolFloat32Err, []bool{true, false})
if err == nil {
t.Errorf("PMapBoolFloat32Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapBoolFloat32Err(someLogicBoolFloat32Err, []bool{true, true, false}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapBoolFloat32Err failed")
}
_, err = PMapBoolFloat32Err(someLogicBoolFloat32Err, []bool{false, false, true}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapBoolFloat32Err failed")
}
_, err = PMapBoolFloat32Err(someLogicBoolFloat32Err, []bool{false, true, false}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapBoolFloat32Err failed")
}
_, err = PMapBoolFloat32Err(someLogicBoolFloat32Err, []bool{true, true, false}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapBoolFloat32Err failed")
}
expectedList = []float32{10, 10}
newList, _ = PMapBoolFloat32Err(someLogicBoolFloat32Err, []bool{true, true}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapBoolFloat32 failed")
}
_, err = PMapBoolFloat32Err(someLogicBoolFloat32Err, []bool{true, true, false}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolFloat32Err failed")
}
_, err = PMapBoolFloat32Err(someLogicBoolFloat32Err, []bool{true, true, false}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolFloat32Err failed")
}
_, err = PMapBoolFloat32Err(someLogicBoolFloat32Err, []bool{false, false, true}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolFloat32Err failed")
}
_, err = PMapBoolFloat32Err(someLogicBoolFloat32Err, []bool{false, true, false}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolFloat32Err failed")
}
_, err = PMapBoolFloat32Err(someLogicBoolFloat32Err, []bool{true, true, false}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolFloat32Err failed")
}
}
func TestPmapBoolFloat64Err(t *testing.T) {
// Test : someLogic
expectedList := []float64{10, 10}
newList, _ := PMapBoolFloat64Err(someLogicBoolFloat64Err, []bool{true, true})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapBoolFloat64Err failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapBoolFloat64Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapBoolFloat64Err failed")
}
r, _ = PMapBoolFloat64Err(nil, []bool{})
if len(r) > 0 {
t.Errorf("PMapBoolFloat64Err failed")
}
_, err := PMapBoolFloat64Err(someLogicBoolFloat64Err, []bool{true, false})
if err == nil {
t.Errorf("PMapBoolFloat64Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapBoolFloat64Err(someLogicBoolFloat64Err, []bool{true, true, false}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapBoolFloat64Err failed")
}
_, err = PMapBoolFloat64Err(someLogicBoolFloat64Err, []bool{false, false, true}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapBoolFloat64Err failed")
}
_, err = PMapBoolFloat64Err(someLogicBoolFloat64Err, []bool{false, true, false}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapBoolFloat64Err failed")
}
_, err = PMapBoolFloat64Err(someLogicBoolFloat64Err, []bool{true, true, false}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapBoolFloat64Err failed")
}
expectedList = []float64{10, 10}
newList, _ = PMapBoolFloat64Err(someLogicBoolFloat64Err, []bool{true, true}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapBoolFloat64 failed")
}
_, err = PMapBoolFloat64Err(someLogicBoolFloat64Err, []bool{true, true, false}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolFloat64Err failed")
}
_, err = PMapBoolFloat64Err(someLogicBoolFloat64Err, []bool{true, true, false}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolFloat64Err failed")
}
_, err = PMapBoolFloat64Err(someLogicBoolFloat64Err, []bool{false, false, true}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolFloat64Err failed")
}
_, err = PMapBoolFloat64Err(someLogicBoolFloat64Err, []bool{false, true, false}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolFloat64Err failed")
}
_, err = PMapBoolFloat64Err(someLogicBoolFloat64Err, []bool{true, true, false}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapBoolFloat64Err failed")
}
}
func TestPmapFloat32IntErr(t *testing.T) {
// Test : add 1 to the list
expectedList := []int{2, 3}
newList, _ := PMapFloat32IntErr(plusOneFloat32IntErr, []float32{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapFloat32Int failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapFloat32IntErr(nil, nil)
if len(r) > 0 {
t.Errorf("PMapFloat32IntErr failed")
}
r, _ = PMapFloat32IntErr(nil, []float32{})
if len(r) > 0 {
t.Errorf("PMapFloat32IntErr failed")
}
_, err := PMapFloat32IntErr(plusOneFloat32IntErr, []float32{1, 2, 3})
if err == nil {
t.Errorf("PMapFloat32IntErr failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapFloat32IntErr(plusOneFloat32IntErr, []float32{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat32IntErr failed")
}
_, err = PMapFloat32IntErr(plusOneFloat32IntErr, []float32{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapFloat32IntErr failed")
}
_, err = PMapFloat32IntErr(plusOneFloat32IntErr, []float32{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat32IntErr failed")
}
_, err = PMapFloat32IntErr(plusOneFloat32IntErr, []float32{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat32IntErr failed")
}
expectedList = []int{2, 3}
newList, _ = PMapFloat32IntErr(plusOneFloat32IntErr, []float32{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapFloat32Int failed")
}
_, err = PMapFloat32IntErr(plusOneFloat32IntErr, []float32{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32IntErr failed")
}
_, err = PMapFloat32IntErr(plusOneFloat32IntErr, []float32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32IntErr failed")
}
_, err = PMapFloat32IntErr(plusOneFloat32IntErr, []float32{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32IntErr failed")
}
_, err = PMapFloat32IntErr(plusOneFloat32IntErr, []float32{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32IntErr failed")
}
_, err = PMapFloat32IntErr(plusOneFloat32IntErr, []float32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32IntErr failed")
}
}
func TestPmapFloat32Int64Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []int64{2, 3}
newList, _ := PMapFloat32Int64Err(plusOneFloat32Int64Err, []float32{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapFloat32Int64 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapFloat32Int64Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapFloat32Int64Err failed")
}
r, _ = PMapFloat32Int64Err(nil, []float32{})
if len(r) > 0 {
t.Errorf("PMapFloat32Int64Err failed")
}
_, err := PMapFloat32Int64Err(plusOneFloat32Int64Err, []float32{1, 2, 3})
if err == nil {
t.Errorf("PMapFloat32Int64Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapFloat32Int64Err(plusOneFloat32Int64Err, []float32{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat32Int64Err failed")
}
_, err = PMapFloat32Int64Err(plusOneFloat32Int64Err, []float32{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapFloat32Int64Err failed")
}
_, err = PMapFloat32Int64Err(plusOneFloat32Int64Err, []float32{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat32Int64Err failed")
}
_, err = PMapFloat32Int64Err(plusOneFloat32Int64Err, []float32{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat32Int64Err failed")
}
expectedList = []int64{2, 3}
newList, _ = PMapFloat32Int64Err(plusOneFloat32Int64Err, []float32{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapFloat32Int64 failed")
}
_, err = PMapFloat32Int64Err(plusOneFloat32Int64Err, []float32{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32Int64Err failed")
}
_, err = PMapFloat32Int64Err(plusOneFloat32Int64Err, []float32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32Int64Err failed")
}
_, err = PMapFloat32Int64Err(plusOneFloat32Int64Err, []float32{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32Int64Err failed")
}
_, err = PMapFloat32Int64Err(plusOneFloat32Int64Err, []float32{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32Int64Err failed")
}
_, err = PMapFloat32Int64Err(plusOneFloat32Int64Err, []float32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32Int64Err failed")
}
}
func TestPmapFloat32Int32Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []int32{2, 3}
newList, _ := PMapFloat32Int32Err(plusOneFloat32Int32Err, []float32{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapFloat32Int32 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapFloat32Int32Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapFloat32Int32Err failed")
}
r, _ = PMapFloat32Int32Err(nil, []float32{})
if len(r) > 0 {
t.Errorf("PMapFloat32Int32Err failed")
}
_, err := PMapFloat32Int32Err(plusOneFloat32Int32Err, []float32{1, 2, 3})
if err == nil {
t.Errorf("PMapFloat32Int32Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapFloat32Int32Err(plusOneFloat32Int32Err, []float32{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat32Int32Err failed")
}
_, err = PMapFloat32Int32Err(plusOneFloat32Int32Err, []float32{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapFloat32Int32Err failed")
}
_, err = PMapFloat32Int32Err(plusOneFloat32Int32Err, []float32{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat32Int32Err failed")
}
_, err = PMapFloat32Int32Err(plusOneFloat32Int32Err, []float32{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat32Int32Err failed")
}
expectedList = []int32{2, 3}
newList, _ = PMapFloat32Int32Err(plusOneFloat32Int32Err, []float32{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapFloat32Int32 failed")
}
_, err = PMapFloat32Int32Err(plusOneFloat32Int32Err, []float32{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32Int32Err failed")
}
_, err = PMapFloat32Int32Err(plusOneFloat32Int32Err, []float32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32Int32Err failed")
}
_, err = PMapFloat32Int32Err(plusOneFloat32Int32Err, []float32{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32Int32Err failed")
}
_, err = PMapFloat32Int32Err(plusOneFloat32Int32Err, []float32{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32Int32Err failed")
}
_, err = PMapFloat32Int32Err(plusOneFloat32Int32Err, []float32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32Int32Err failed")
}
}
func TestPmapFloat32Int16Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []int16{2, 3}
newList, _ := PMapFloat32Int16Err(plusOneFloat32Int16Err, []float32{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapFloat32Int16 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapFloat32Int16Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapFloat32Int16Err failed")
}
r, _ = PMapFloat32Int16Err(nil, []float32{})
if len(r) > 0 {
t.Errorf("PMapFloat32Int16Err failed")
}
_, err := PMapFloat32Int16Err(plusOneFloat32Int16Err, []float32{1, 2, 3})
if err == nil {
t.Errorf("PMapFloat32Int16Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapFloat32Int16Err(plusOneFloat32Int16Err, []float32{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat32Int16Err failed")
}
_, err = PMapFloat32Int16Err(plusOneFloat32Int16Err, []float32{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapFloat32Int16Err failed")
}
_, err = PMapFloat32Int16Err(plusOneFloat32Int16Err, []float32{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat32Int16Err failed")
}
_, err = PMapFloat32Int16Err(plusOneFloat32Int16Err, []float32{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat32Int16Err failed")
}
expectedList = []int16{2, 3}
newList, _ = PMapFloat32Int16Err(plusOneFloat32Int16Err, []float32{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapFloat32Int16 failed")
}
_, err = PMapFloat32Int16Err(plusOneFloat32Int16Err, []float32{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32Int16Err failed")
}
_, err = PMapFloat32Int16Err(plusOneFloat32Int16Err, []float32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32Int16Err failed")
}
_, err = PMapFloat32Int16Err(plusOneFloat32Int16Err, []float32{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32Int16Err failed")
}
_, err = PMapFloat32Int16Err(plusOneFloat32Int16Err, []float32{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32Int16Err failed")
}
_, err = PMapFloat32Int16Err(plusOneFloat32Int16Err, []float32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32Int16Err failed")
}
}
func TestPmapFloat32Int8Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []int8{2, 3}
newList, _ := PMapFloat32Int8Err(plusOneFloat32Int8Err, []float32{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapFloat32Int8 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapFloat32Int8Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapFloat32Int8Err failed")
}
r, _ = PMapFloat32Int8Err(nil, []float32{})
if len(r) > 0 {
t.Errorf("PMapFloat32Int8Err failed")
}
_, err := PMapFloat32Int8Err(plusOneFloat32Int8Err, []float32{1, 2, 3})
if err == nil {
t.Errorf("PMapFloat32Int8Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapFloat32Int8Err(plusOneFloat32Int8Err, []float32{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat32Int8Err failed")
}
_, err = PMapFloat32Int8Err(plusOneFloat32Int8Err, []float32{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapFloat32Int8Err failed")
}
_, err = PMapFloat32Int8Err(plusOneFloat32Int8Err, []float32{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat32Int8Err failed")
}
_, err = PMapFloat32Int8Err(plusOneFloat32Int8Err, []float32{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat32Int8Err failed")
}
expectedList = []int8{2, 3}
newList, _ = PMapFloat32Int8Err(plusOneFloat32Int8Err, []float32{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapFloat32Int8 failed")
}
_, err = PMapFloat32Int8Err(plusOneFloat32Int8Err, []float32{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32Int8Err failed")
}
_, err = PMapFloat32Int8Err(plusOneFloat32Int8Err, []float32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32Int8Err failed")
}
_, err = PMapFloat32Int8Err(plusOneFloat32Int8Err, []float32{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32Int8Err failed")
}
_, err = PMapFloat32Int8Err(plusOneFloat32Int8Err, []float32{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32Int8Err failed")
}
_, err = PMapFloat32Int8Err(plusOneFloat32Int8Err, []float32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32Int8Err failed")
}
}
func TestPmapFloat32UintErr(t *testing.T) {
// Test : add 1 to the list
expectedList := []uint{2, 3}
newList, _ := PMapFloat32UintErr(plusOneFloat32UintErr, []float32{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapFloat32Uint failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapFloat32UintErr(nil, nil)
if len(r) > 0 {
t.Errorf("PMapFloat32UintErr failed")
}
r, _ = PMapFloat32UintErr(nil, []float32{})
if len(r) > 0 {
t.Errorf("PMapFloat32UintErr failed")
}
_, err := PMapFloat32UintErr(plusOneFloat32UintErr, []float32{1, 2, 3})
if err == nil {
t.Errorf("PMapFloat32UintErr failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapFloat32UintErr(plusOneFloat32UintErr, []float32{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat32UintErr failed")
}
_, err = PMapFloat32UintErr(plusOneFloat32UintErr, []float32{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapFloat32UintErr failed")
}
_, err = PMapFloat32UintErr(plusOneFloat32UintErr, []float32{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat32UintErr failed")
}
_, err = PMapFloat32UintErr(plusOneFloat32UintErr, []float32{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat32UintErr failed")
}
expectedList = []uint{2, 3}
newList, _ = PMapFloat32UintErr(plusOneFloat32UintErr, []float32{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapFloat32Uint failed")
}
_, err = PMapFloat32UintErr(plusOneFloat32UintErr, []float32{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32UintErr failed")
}
_, err = PMapFloat32UintErr(plusOneFloat32UintErr, []float32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32UintErr failed")
}
_, err = PMapFloat32UintErr(plusOneFloat32UintErr, []float32{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32UintErr failed")
}
_, err = PMapFloat32UintErr(plusOneFloat32UintErr, []float32{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32UintErr failed")
}
_, err = PMapFloat32UintErr(plusOneFloat32UintErr, []float32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32UintErr failed")
}
}
func TestPmapFloat32Uint64Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []uint64{2, 3}
newList, _ := PMapFloat32Uint64Err(plusOneFloat32Uint64Err, []float32{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapFloat32Uint64 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapFloat32Uint64Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapFloat32Uint64Err failed")
}
r, _ = PMapFloat32Uint64Err(nil, []float32{})
if len(r) > 0 {
t.Errorf("PMapFloat32Uint64Err failed")
}
_, err := PMapFloat32Uint64Err(plusOneFloat32Uint64Err, []float32{1, 2, 3})
if err == nil {
t.Errorf("PMapFloat32Uint64Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapFloat32Uint64Err(plusOneFloat32Uint64Err, []float32{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat32Uint64Err failed")
}
_, err = PMapFloat32Uint64Err(plusOneFloat32Uint64Err, []float32{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapFloat32Uint64Err failed")
}
_, err = PMapFloat32Uint64Err(plusOneFloat32Uint64Err, []float32{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat32Uint64Err failed")
}
_, err = PMapFloat32Uint64Err(plusOneFloat32Uint64Err, []float32{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat32Uint64Err failed")
}
expectedList = []uint64{2, 3}
newList, _ = PMapFloat32Uint64Err(plusOneFloat32Uint64Err, []float32{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapFloat32Uint64 failed")
}
_, err = PMapFloat32Uint64Err(plusOneFloat32Uint64Err, []float32{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32Uint64Err failed")
}
_, err = PMapFloat32Uint64Err(plusOneFloat32Uint64Err, []float32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32Uint64Err failed")
}
_, err = PMapFloat32Uint64Err(plusOneFloat32Uint64Err, []float32{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32Uint64Err failed")
}
_, err = PMapFloat32Uint64Err(plusOneFloat32Uint64Err, []float32{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32Uint64Err failed")
}
_, err = PMapFloat32Uint64Err(plusOneFloat32Uint64Err, []float32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32Uint64Err failed")
}
}
func TestPmapFloat32Uint32Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []uint32{2, 3}
newList, _ := PMapFloat32Uint32Err(plusOneFloat32Uint32Err, []float32{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapFloat32Uint32 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapFloat32Uint32Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapFloat32Uint32Err failed")
}
r, _ = PMapFloat32Uint32Err(nil, []float32{})
if len(r) > 0 {
t.Errorf("PMapFloat32Uint32Err failed")
}
_, err := PMapFloat32Uint32Err(plusOneFloat32Uint32Err, []float32{1, 2, 3})
if err == nil {
t.Errorf("PMapFloat32Uint32Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapFloat32Uint32Err(plusOneFloat32Uint32Err, []float32{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat32Uint32Err failed")
}
_, err = PMapFloat32Uint32Err(plusOneFloat32Uint32Err, []float32{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapFloat32Uint32Err failed")
}
_, err = PMapFloat32Uint32Err(plusOneFloat32Uint32Err, []float32{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat32Uint32Err failed")
}
_, err = PMapFloat32Uint32Err(plusOneFloat32Uint32Err, []float32{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat32Uint32Err failed")
}
expectedList = []uint32{2, 3}
newList, _ = PMapFloat32Uint32Err(plusOneFloat32Uint32Err, []float32{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapFloat32Uint32 failed")
}
_, err = PMapFloat32Uint32Err(plusOneFloat32Uint32Err, []float32{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32Uint32Err failed")
}
_, err = PMapFloat32Uint32Err(plusOneFloat32Uint32Err, []float32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32Uint32Err failed")
}
_, err = PMapFloat32Uint32Err(plusOneFloat32Uint32Err, []float32{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32Uint32Err failed")
}
_, err = PMapFloat32Uint32Err(plusOneFloat32Uint32Err, []float32{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32Uint32Err failed")
}
_, err = PMapFloat32Uint32Err(plusOneFloat32Uint32Err, []float32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32Uint32Err failed")
}
}
func TestPmapFloat32Uint16Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []uint16{2, 3}
newList, _ := PMapFloat32Uint16Err(plusOneFloat32Uint16Err, []float32{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapFloat32Uint16 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapFloat32Uint16Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapFloat32Uint16Err failed")
}
r, _ = PMapFloat32Uint16Err(nil, []float32{})
if len(r) > 0 {
t.Errorf("PMapFloat32Uint16Err failed")
}
_, err := PMapFloat32Uint16Err(plusOneFloat32Uint16Err, []float32{1, 2, 3})
if err == nil {
t.Errorf("PMapFloat32Uint16Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapFloat32Uint16Err(plusOneFloat32Uint16Err, []float32{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat32Uint16Err failed")
}
_, err = PMapFloat32Uint16Err(plusOneFloat32Uint16Err, []float32{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapFloat32Uint16Err failed")
}
_, err = PMapFloat32Uint16Err(plusOneFloat32Uint16Err, []float32{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat32Uint16Err failed")
}
_, err = PMapFloat32Uint16Err(plusOneFloat32Uint16Err, []float32{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat32Uint16Err failed")
}
expectedList = []uint16{2, 3}
newList, _ = PMapFloat32Uint16Err(plusOneFloat32Uint16Err, []float32{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapFloat32Uint16 failed")
}
_, err = PMapFloat32Uint16Err(plusOneFloat32Uint16Err, []float32{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32Uint16Err failed")
}
_, err = PMapFloat32Uint16Err(plusOneFloat32Uint16Err, []float32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32Uint16Err failed")
}
_, err = PMapFloat32Uint16Err(plusOneFloat32Uint16Err, []float32{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32Uint16Err failed")
}
_, err = PMapFloat32Uint16Err(plusOneFloat32Uint16Err, []float32{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32Uint16Err failed")
}
_, err = PMapFloat32Uint16Err(plusOneFloat32Uint16Err, []float32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32Uint16Err failed")
}
}
func TestPmapFloat32Uint8Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []uint8{2, 3}
newList, _ := PMapFloat32Uint8Err(plusOneFloat32Uint8Err, []float32{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapFloat32Uint8 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapFloat32Uint8Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapFloat32Uint8Err failed")
}
r, _ = PMapFloat32Uint8Err(nil, []float32{})
if len(r) > 0 {
t.Errorf("PMapFloat32Uint8Err failed")
}
_, err := PMapFloat32Uint8Err(plusOneFloat32Uint8Err, []float32{1, 2, 3})
if err == nil {
t.Errorf("PMapFloat32Uint8Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapFloat32Uint8Err(plusOneFloat32Uint8Err, []float32{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat32Uint8Err failed")
}
_, err = PMapFloat32Uint8Err(plusOneFloat32Uint8Err, []float32{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapFloat32Uint8Err failed")
}
_, err = PMapFloat32Uint8Err(plusOneFloat32Uint8Err, []float32{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat32Uint8Err failed")
}
_, err = PMapFloat32Uint8Err(plusOneFloat32Uint8Err, []float32{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat32Uint8Err failed")
}
expectedList = []uint8{2, 3}
newList, _ = PMapFloat32Uint8Err(plusOneFloat32Uint8Err, []float32{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapFloat32Uint8 failed")
}
_, err = PMapFloat32Uint8Err(plusOneFloat32Uint8Err, []float32{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32Uint8Err failed")
}
_, err = PMapFloat32Uint8Err(plusOneFloat32Uint8Err, []float32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32Uint8Err failed")
}
_, err = PMapFloat32Uint8Err(plusOneFloat32Uint8Err, []float32{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32Uint8Err failed")
}
_, err = PMapFloat32Uint8Err(plusOneFloat32Uint8Err, []float32{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32Uint8Err failed")
}
_, err = PMapFloat32Uint8Err(plusOneFloat32Uint8Err, []float32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32Uint8Err failed")
}
}
func TestPmapFloat32StrErr(t *testing.T) {
// Test : someLogic
expectedList := []string{"10"}
newList, _ := PMapFloat32StrErr(someLogicFloat32StrErr, []float32{10})
if newList[0] != expectedList[0] {
t.Errorf("PMapFloat32StrErr failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapFloat32StrErr(nil, nil)
if len(r) > 0 {
t.Errorf("PMapFloat32StrErr failed")
}
r, _ = PMapFloat32StrErr(nil, []float32{})
if len(r) > 0 {
t.Errorf("PMapFloat32StrErr failed")
}
_, err := PMapFloat32StrErr(someLogicFloat32StrErr, []float32{10, 0})
if err == nil {
t.Errorf("PMapFloat32StrErr failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapFloat32StrErr(someLogicFloat32StrErr, []float32{10, 10, 0}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat32StrErr failed")
}
_, err = PMapFloat32StrErr(someLogicFloat32StrErr, []float32{0, 0, 10}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapFloat32StrErr failed")
}
_, err = PMapFloat32StrErr(someLogicFloat32StrErr, []float32{0, 10, 0}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat32StrErr failed")
}
_, err = PMapFloat32StrErr(someLogicFloat32StrErr, []float32{10, 10, 0}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat32StrErr failed")
}
expectedList = []string{"10", "10"}
newList, _ = PMapFloat32StrErr(someLogicFloat32StrErr, []float32{10, 10}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapFloat32Str failed")
}
_, err = PMapFloat32StrErr(someLogicFloat32StrErr, []float32{10, 10, 0}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32StrErr failed")
}
_, err = PMapFloat32StrErr(someLogicFloat32StrErr, []float32{10, 10, 0}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32StrErr failed")
}
_, err = PMapFloat32StrErr(someLogicFloat32StrErr, []float32{0, 0, 10}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32StrErr failed")
}
_, err = PMapFloat32StrErr(someLogicFloat32StrErr, []float32{0, 10, 0}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32StrErr failed")
}
_, err = PMapFloat32StrErr(someLogicFloat32StrErr, []float32{10, 10, 0}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32StrErr failed")
}
}
func TestPmapFloat32BoolErr(t *testing.T) {
// Test : someLogic
expectedList := []bool{true, false}
newList, _ := PMapFloat32BoolErr(someLogicFloat32BoolErr, []float32{10, 0})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapFloat32BoolErr failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapFloat32BoolErr(nil, nil)
if len(r) > 0 {
t.Errorf("PMapFloat32BoolErr failed")
}
r, _ = PMapFloat32BoolErr(nil, []float32{})
if len(r) > 0 {
t.Errorf("PMapFloat32BoolErr failed")
}
_, err := PMapFloat32BoolErr(someLogicFloat32BoolErr, []float32{10, 3, 3})
if err == nil {
t.Errorf("PMapFloat32BoolErr failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapFloat32BoolErr(someLogicFloat32BoolErr, []float32{10, 10, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat32BoolErr failed")
}
_, err = PMapFloat32BoolErr(someLogicFloat32BoolErr, []float32{3, 3, 10}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapFloat32BoolErr failed")
}
_, err = PMapFloat32BoolErr(someLogicFloat32BoolErr, []float32{3, 10, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat32BoolErr failed")
}
_, err = PMapFloat32BoolErr(someLogicFloat32BoolErr, []float32{10, 10, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat32BoolErr failed")
}
expectedList = []bool{true, true}
newList, _ = PMapFloat32BoolErr(someLogicFloat32BoolErr, []float32{10, 10}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapFloat32Bool failed")
}
_, err = PMapFloat32BoolErr(someLogicFloat32BoolErr, []float32{10, 10, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32BoolErr failed")
}
_, err = PMapFloat32BoolErr(someLogicFloat32BoolErr, []float32{10, 10, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32BoolErr failed")
}
_, err = PMapFloat32BoolErr(someLogicFloat32BoolErr, []float32{3, 3, 10}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32BoolErr failed")
}
_, err = PMapFloat32BoolErr(someLogicFloat32BoolErr, []float32{3, 10, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32BoolErr failed")
}
_, err = PMapFloat32BoolErr(someLogicFloat32BoolErr, []float32{10, 10, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32BoolErr failed")
}
}
func TestPmapFloat32Float64Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []float64{2, 3}
newList, _ := PMapFloat32Float64Err(plusOneFloat32Float64Err, []float32{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapFloat32Float64 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapFloat32Float64Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapFloat32Float64Err failed")
}
r, _ = PMapFloat32Float64Err(nil, []float32{})
if len(r) > 0 {
t.Errorf("PMapFloat32Float64Err failed")
}
_, err := PMapFloat32Float64Err(plusOneFloat32Float64Err, []float32{1, 2, 3})
if err == nil {
t.Errorf("PMapFloat32Float64Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapFloat32Float64Err(plusOneFloat32Float64Err, []float32{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat32Float64Err failed")
}
_, err = PMapFloat32Float64Err(plusOneFloat32Float64Err, []float32{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapFloat32Float64Err failed")
}
_, err = PMapFloat32Float64Err(plusOneFloat32Float64Err, []float32{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat32Float64Err failed")
}
_, err = PMapFloat32Float64Err(plusOneFloat32Float64Err, []float32{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat32Float64Err failed")
}
expectedList = []float64{2, 3}
newList, _ = PMapFloat32Float64Err(plusOneFloat32Float64Err, []float32{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapFloat32Float64 failed")
}
_, err = PMapFloat32Float64Err(plusOneFloat32Float64Err, []float32{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32Float64Err failed")
}
_, err = PMapFloat32Float64Err(plusOneFloat32Float64Err, []float32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32Float64Err failed")
}
_, err = PMapFloat32Float64Err(plusOneFloat32Float64Err, []float32{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32Float64Err failed")
}
_, err = PMapFloat32Float64Err(plusOneFloat32Float64Err, []float32{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32Float64Err failed")
}
_, err = PMapFloat32Float64Err(plusOneFloat32Float64Err, []float32{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat32Float64Err failed")
}
}
func TestPmapFloat64IntErr(t *testing.T) {
// Test : add 1 to the list
expectedList := []int{2, 3}
newList, _ := PMapFloat64IntErr(plusOneFloat64IntErr, []float64{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapFloat64Int failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapFloat64IntErr(nil, nil)
if len(r) > 0 {
t.Errorf("PMapFloat64IntErr failed")
}
r, _ = PMapFloat64IntErr(nil, []float64{})
if len(r) > 0 {
t.Errorf("PMapFloat64IntErr failed")
}
_, err := PMapFloat64IntErr(plusOneFloat64IntErr, []float64{1, 2, 3})
if err == nil {
t.Errorf("PMapFloat64IntErr failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapFloat64IntErr(plusOneFloat64IntErr, []float64{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat64IntErr failed")
}
_, err = PMapFloat64IntErr(plusOneFloat64IntErr, []float64{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapFloat64IntErr failed")
}
_, err = PMapFloat64IntErr(plusOneFloat64IntErr, []float64{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat64IntErr failed")
}
_, err = PMapFloat64IntErr(plusOneFloat64IntErr, []float64{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat64IntErr failed")
}
expectedList = []int{2, 3}
newList, _ = PMapFloat64IntErr(plusOneFloat64IntErr, []float64{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapFloat64Int failed")
}
_, err = PMapFloat64IntErr(plusOneFloat64IntErr, []float64{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64IntErr failed")
}
_, err = PMapFloat64IntErr(plusOneFloat64IntErr, []float64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64IntErr failed")
}
_, err = PMapFloat64IntErr(plusOneFloat64IntErr, []float64{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64IntErr failed")
}
_, err = PMapFloat64IntErr(plusOneFloat64IntErr, []float64{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64IntErr failed")
}
_, err = PMapFloat64IntErr(plusOneFloat64IntErr, []float64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64IntErr failed")
}
}
func TestPmapFloat64Int64Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []int64{2, 3}
newList, _ := PMapFloat64Int64Err(plusOneFloat64Int64Err, []float64{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapFloat64Int64 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapFloat64Int64Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapFloat64Int64Err failed")
}
r, _ = PMapFloat64Int64Err(nil, []float64{})
if len(r) > 0 {
t.Errorf("PMapFloat64Int64Err failed")
}
_, err := PMapFloat64Int64Err(plusOneFloat64Int64Err, []float64{1, 2, 3})
if err == nil {
t.Errorf("PMapFloat64Int64Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapFloat64Int64Err(plusOneFloat64Int64Err, []float64{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat64Int64Err failed")
}
_, err = PMapFloat64Int64Err(plusOneFloat64Int64Err, []float64{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapFloat64Int64Err failed")
}
_, err = PMapFloat64Int64Err(plusOneFloat64Int64Err, []float64{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat64Int64Err failed")
}
_, err = PMapFloat64Int64Err(plusOneFloat64Int64Err, []float64{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat64Int64Err failed")
}
expectedList = []int64{2, 3}
newList, _ = PMapFloat64Int64Err(plusOneFloat64Int64Err, []float64{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapFloat64Int64 failed")
}
_, err = PMapFloat64Int64Err(plusOneFloat64Int64Err, []float64{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64Int64Err failed")
}
_, err = PMapFloat64Int64Err(plusOneFloat64Int64Err, []float64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64Int64Err failed")
}
_, err = PMapFloat64Int64Err(plusOneFloat64Int64Err, []float64{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64Int64Err failed")
}
_, err = PMapFloat64Int64Err(plusOneFloat64Int64Err, []float64{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64Int64Err failed")
}
_, err = PMapFloat64Int64Err(plusOneFloat64Int64Err, []float64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64Int64Err failed")
}
}
func TestPmapFloat64Int32Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []int32{2, 3}
newList, _ := PMapFloat64Int32Err(plusOneFloat64Int32Err, []float64{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapFloat64Int32 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapFloat64Int32Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapFloat64Int32Err failed")
}
r, _ = PMapFloat64Int32Err(nil, []float64{})
if len(r) > 0 {
t.Errorf("PMapFloat64Int32Err failed")
}
_, err := PMapFloat64Int32Err(plusOneFloat64Int32Err, []float64{1, 2, 3})
if err == nil {
t.Errorf("PMapFloat64Int32Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapFloat64Int32Err(plusOneFloat64Int32Err, []float64{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat64Int32Err failed")
}
_, err = PMapFloat64Int32Err(plusOneFloat64Int32Err, []float64{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapFloat64Int32Err failed")
}
_, err = PMapFloat64Int32Err(plusOneFloat64Int32Err, []float64{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat64Int32Err failed")
}
_, err = PMapFloat64Int32Err(plusOneFloat64Int32Err, []float64{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat64Int32Err failed")
}
expectedList = []int32{2, 3}
newList, _ = PMapFloat64Int32Err(plusOneFloat64Int32Err, []float64{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapFloat64Int32 failed")
}
_, err = PMapFloat64Int32Err(plusOneFloat64Int32Err, []float64{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64Int32Err failed")
}
_, err = PMapFloat64Int32Err(plusOneFloat64Int32Err, []float64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64Int32Err failed")
}
_, err = PMapFloat64Int32Err(plusOneFloat64Int32Err, []float64{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64Int32Err failed")
}
_, err = PMapFloat64Int32Err(plusOneFloat64Int32Err, []float64{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64Int32Err failed")
}
_, err = PMapFloat64Int32Err(plusOneFloat64Int32Err, []float64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64Int32Err failed")
}
}
func TestPmapFloat64Int16Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []int16{2, 3}
newList, _ := PMapFloat64Int16Err(plusOneFloat64Int16Err, []float64{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapFloat64Int16 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapFloat64Int16Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapFloat64Int16Err failed")
}
r, _ = PMapFloat64Int16Err(nil, []float64{})
if len(r) > 0 {
t.Errorf("PMapFloat64Int16Err failed")
}
_, err := PMapFloat64Int16Err(plusOneFloat64Int16Err, []float64{1, 2, 3})
if err == nil {
t.Errorf("PMapFloat64Int16Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapFloat64Int16Err(plusOneFloat64Int16Err, []float64{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat64Int16Err failed")
}
_, err = PMapFloat64Int16Err(plusOneFloat64Int16Err, []float64{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapFloat64Int16Err failed")
}
_, err = PMapFloat64Int16Err(plusOneFloat64Int16Err, []float64{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat64Int16Err failed")
}
_, err = PMapFloat64Int16Err(plusOneFloat64Int16Err, []float64{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat64Int16Err failed")
}
expectedList = []int16{2, 3}
newList, _ = PMapFloat64Int16Err(plusOneFloat64Int16Err, []float64{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapFloat64Int16 failed")
}
_, err = PMapFloat64Int16Err(plusOneFloat64Int16Err, []float64{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64Int16Err failed")
}
_, err = PMapFloat64Int16Err(plusOneFloat64Int16Err, []float64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64Int16Err failed")
}
_, err = PMapFloat64Int16Err(plusOneFloat64Int16Err, []float64{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64Int16Err failed")
}
_, err = PMapFloat64Int16Err(plusOneFloat64Int16Err, []float64{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64Int16Err failed")
}
_, err = PMapFloat64Int16Err(plusOneFloat64Int16Err, []float64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64Int16Err failed")
}
}
func TestPmapFloat64Int8Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []int8{2, 3}
newList, _ := PMapFloat64Int8Err(plusOneFloat64Int8Err, []float64{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapFloat64Int8 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapFloat64Int8Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapFloat64Int8Err failed")
}
r, _ = PMapFloat64Int8Err(nil, []float64{})
if len(r) > 0 {
t.Errorf("PMapFloat64Int8Err failed")
}
_, err := PMapFloat64Int8Err(plusOneFloat64Int8Err, []float64{1, 2, 3})
if err == nil {
t.Errorf("PMapFloat64Int8Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapFloat64Int8Err(plusOneFloat64Int8Err, []float64{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat64Int8Err failed")
}
_, err = PMapFloat64Int8Err(plusOneFloat64Int8Err, []float64{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapFloat64Int8Err failed")
}
_, err = PMapFloat64Int8Err(plusOneFloat64Int8Err, []float64{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat64Int8Err failed")
}
_, err = PMapFloat64Int8Err(plusOneFloat64Int8Err, []float64{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat64Int8Err failed")
}
expectedList = []int8{2, 3}
newList, _ = PMapFloat64Int8Err(plusOneFloat64Int8Err, []float64{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapFloat64Int8 failed")
}
_, err = PMapFloat64Int8Err(plusOneFloat64Int8Err, []float64{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64Int8Err failed")
}
_, err = PMapFloat64Int8Err(plusOneFloat64Int8Err, []float64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64Int8Err failed")
}
_, err = PMapFloat64Int8Err(plusOneFloat64Int8Err, []float64{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64Int8Err failed")
}
_, err = PMapFloat64Int8Err(plusOneFloat64Int8Err, []float64{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64Int8Err failed")
}
_, err = PMapFloat64Int8Err(plusOneFloat64Int8Err, []float64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64Int8Err failed")
}
}
func TestPmapFloat64UintErr(t *testing.T) {
// Test : add 1 to the list
expectedList := []uint{2, 3}
newList, _ := PMapFloat64UintErr(plusOneFloat64UintErr, []float64{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapFloat64Uint failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapFloat64UintErr(nil, nil)
if len(r) > 0 {
t.Errorf("PMapFloat64UintErr failed")
}
r, _ = PMapFloat64UintErr(nil, []float64{})
if len(r) > 0 {
t.Errorf("PMapFloat64UintErr failed")
}
_, err := PMapFloat64UintErr(plusOneFloat64UintErr, []float64{1, 2, 3})
if err == nil {
t.Errorf("PMapFloat64UintErr failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapFloat64UintErr(plusOneFloat64UintErr, []float64{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat64UintErr failed")
}
_, err = PMapFloat64UintErr(plusOneFloat64UintErr, []float64{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapFloat64UintErr failed")
}
_, err = PMapFloat64UintErr(plusOneFloat64UintErr, []float64{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat64UintErr failed")
}
_, err = PMapFloat64UintErr(plusOneFloat64UintErr, []float64{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat64UintErr failed")
}
expectedList = []uint{2, 3}
newList, _ = PMapFloat64UintErr(plusOneFloat64UintErr, []float64{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapFloat64Uint failed")
}
_, err = PMapFloat64UintErr(plusOneFloat64UintErr, []float64{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64UintErr failed")
}
_, err = PMapFloat64UintErr(plusOneFloat64UintErr, []float64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64UintErr failed")
}
_, err = PMapFloat64UintErr(plusOneFloat64UintErr, []float64{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64UintErr failed")
}
_, err = PMapFloat64UintErr(plusOneFloat64UintErr, []float64{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64UintErr failed")
}
_, err = PMapFloat64UintErr(plusOneFloat64UintErr, []float64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64UintErr failed")
}
}
func TestPmapFloat64Uint64Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []uint64{2, 3}
newList, _ := PMapFloat64Uint64Err(plusOneFloat64Uint64Err, []float64{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapFloat64Uint64 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapFloat64Uint64Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapFloat64Uint64Err failed")
}
r, _ = PMapFloat64Uint64Err(nil, []float64{})
if len(r) > 0 {
t.Errorf("PMapFloat64Uint64Err failed")
}
_, err := PMapFloat64Uint64Err(plusOneFloat64Uint64Err, []float64{1, 2, 3})
if err == nil {
t.Errorf("PMapFloat64Uint64Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapFloat64Uint64Err(plusOneFloat64Uint64Err, []float64{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat64Uint64Err failed")
}
_, err = PMapFloat64Uint64Err(plusOneFloat64Uint64Err, []float64{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapFloat64Uint64Err failed")
}
_, err = PMapFloat64Uint64Err(plusOneFloat64Uint64Err, []float64{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat64Uint64Err failed")
}
_, err = PMapFloat64Uint64Err(plusOneFloat64Uint64Err, []float64{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat64Uint64Err failed")
}
expectedList = []uint64{2, 3}
newList, _ = PMapFloat64Uint64Err(plusOneFloat64Uint64Err, []float64{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapFloat64Uint64 failed")
}
_, err = PMapFloat64Uint64Err(plusOneFloat64Uint64Err, []float64{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64Uint64Err failed")
}
_, err = PMapFloat64Uint64Err(plusOneFloat64Uint64Err, []float64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64Uint64Err failed")
}
_, err = PMapFloat64Uint64Err(plusOneFloat64Uint64Err, []float64{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64Uint64Err failed")
}
_, err = PMapFloat64Uint64Err(plusOneFloat64Uint64Err, []float64{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64Uint64Err failed")
}
_, err = PMapFloat64Uint64Err(plusOneFloat64Uint64Err, []float64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64Uint64Err failed")
}
}
func TestPmapFloat64Uint32Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []uint32{2, 3}
newList, _ := PMapFloat64Uint32Err(plusOneFloat64Uint32Err, []float64{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapFloat64Uint32 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapFloat64Uint32Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapFloat64Uint32Err failed")
}
r, _ = PMapFloat64Uint32Err(nil, []float64{})
if len(r) > 0 {
t.Errorf("PMapFloat64Uint32Err failed")
}
_, err := PMapFloat64Uint32Err(plusOneFloat64Uint32Err, []float64{1, 2, 3})
if err == nil {
t.Errorf("PMapFloat64Uint32Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapFloat64Uint32Err(plusOneFloat64Uint32Err, []float64{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat64Uint32Err failed")
}
_, err = PMapFloat64Uint32Err(plusOneFloat64Uint32Err, []float64{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapFloat64Uint32Err failed")
}
_, err = PMapFloat64Uint32Err(plusOneFloat64Uint32Err, []float64{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat64Uint32Err failed")
}
_, err = PMapFloat64Uint32Err(plusOneFloat64Uint32Err, []float64{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat64Uint32Err failed")
}
expectedList = []uint32{2, 3}
newList, _ = PMapFloat64Uint32Err(plusOneFloat64Uint32Err, []float64{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapFloat64Uint32 failed")
}
_, err = PMapFloat64Uint32Err(plusOneFloat64Uint32Err, []float64{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64Uint32Err failed")
}
_, err = PMapFloat64Uint32Err(plusOneFloat64Uint32Err, []float64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64Uint32Err failed")
}
_, err = PMapFloat64Uint32Err(plusOneFloat64Uint32Err, []float64{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64Uint32Err failed")
}
_, err = PMapFloat64Uint32Err(plusOneFloat64Uint32Err, []float64{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64Uint32Err failed")
}
_, err = PMapFloat64Uint32Err(plusOneFloat64Uint32Err, []float64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64Uint32Err failed")
}
}
func TestPmapFloat64Uint16Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []uint16{2, 3}
newList, _ := PMapFloat64Uint16Err(plusOneFloat64Uint16Err, []float64{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapFloat64Uint16 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapFloat64Uint16Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapFloat64Uint16Err failed")
}
r, _ = PMapFloat64Uint16Err(nil, []float64{})
if len(r) > 0 {
t.Errorf("PMapFloat64Uint16Err failed")
}
_, err := PMapFloat64Uint16Err(plusOneFloat64Uint16Err, []float64{1, 2, 3})
if err == nil {
t.Errorf("PMapFloat64Uint16Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapFloat64Uint16Err(plusOneFloat64Uint16Err, []float64{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat64Uint16Err failed")
}
_, err = PMapFloat64Uint16Err(plusOneFloat64Uint16Err, []float64{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapFloat64Uint16Err failed")
}
_, err = PMapFloat64Uint16Err(plusOneFloat64Uint16Err, []float64{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat64Uint16Err failed")
}
_, err = PMapFloat64Uint16Err(plusOneFloat64Uint16Err, []float64{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat64Uint16Err failed")
}
expectedList = []uint16{2, 3}
newList, _ = PMapFloat64Uint16Err(plusOneFloat64Uint16Err, []float64{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapFloat64Uint16 failed")
}
_, err = PMapFloat64Uint16Err(plusOneFloat64Uint16Err, []float64{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64Uint16Err failed")
}
_, err = PMapFloat64Uint16Err(plusOneFloat64Uint16Err, []float64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64Uint16Err failed")
}
_, err = PMapFloat64Uint16Err(plusOneFloat64Uint16Err, []float64{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64Uint16Err failed")
}
_, err = PMapFloat64Uint16Err(plusOneFloat64Uint16Err, []float64{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64Uint16Err failed")
}
_, err = PMapFloat64Uint16Err(plusOneFloat64Uint16Err, []float64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64Uint16Err failed")
}
}
func TestPmapFloat64Uint8Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []uint8{2, 3}
newList, _ := PMapFloat64Uint8Err(plusOneFloat64Uint8Err, []float64{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapFloat64Uint8 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapFloat64Uint8Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapFloat64Uint8Err failed")
}
r, _ = PMapFloat64Uint8Err(nil, []float64{})
if len(r) > 0 {
t.Errorf("PMapFloat64Uint8Err failed")
}
_, err := PMapFloat64Uint8Err(plusOneFloat64Uint8Err, []float64{1, 2, 3})
if err == nil {
t.Errorf("PMapFloat64Uint8Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapFloat64Uint8Err(plusOneFloat64Uint8Err, []float64{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat64Uint8Err failed")
}
_, err = PMapFloat64Uint8Err(plusOneFloat64Uint8Err, []float64{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapFloat64Uint8Err failed")
}
_, err = PMapFloat64Uint8Err(plusOneFloat64Uint8Err, []float64{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat64Uint8Err failed")
}
_, err = PMapFloat64Uint8Err(plusOneFloat64Uint8Err, []float64{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat64Uint8Err failed")
}
expectedList = []uint8{2, 3}
newList, _ = PMapFloat64Uint8Err(plusOneFloat64Uint8Err, []float64{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapFloat64Uint8 failed")
}
_, err = PMapFloat64Uint8Err(plusOneFloat64Uint8Err, []float64{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64Uint8Err failed")
}
_, err = PMapFloat64Uint8Err(plusOneFloat64Uint8Err, []float64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64Uint8Err failed")
}
_, err = PMapFloat64Uint8Err(plusOneFloat64Uint8Err, []float64{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64Uint8Err failed")
}
_, err = PMapFloat64Uint8Err(plusOneFloat64Uint8Err, []float64{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64Uint8Err failed")
}
_, err = PMapFloat64Uint8Err(plusOneFloat64Uint8Err, []float64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64Uint8Err failed")
}
}
func TestPmapFloat64StrErr(t *testing.T) {
// Test : someLogic
expectedList := []string{"10"}
newList, _ := PMapFloat64StrErr(someLogicFloat64StrErr, []float64{10})
if newList[0] != expectedList[0] {
t.Errorf("PMapFloat64StrErr failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapFloat64StrErr(nil, nil)
if len(r) > 0 {
t.Errorf("PMapFloat64StrErr failed")
}
r, _ = PMapFloat64StrErr(nil, []float64{})
if len(r) > 0 {
t.Errorf("PMapFloat64StrErr failed")
}
_, err := PMapFloat64StrErr(someLogicFloat64StrErr, []float64{10, 0})
if err == nil {
t.Errorf("PMapFloat64StrErr failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapFloat64StrErr(someLogicFloat64StrErr, []float64{10, 10, 0}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat64StrErr failed")
}
_, err = PMapFloat64StrErr(someLogicFloat64StrErr, []float64{0, 0, 10}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapFloat64StrErr failed")
}
_, err = PMapFloat64StrErr(someLogicFloat64StrErr, []float64{0, 10, 0}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat64StrErr failed")
}
_, err = PMapFloat64StrErr(someLogicFloat64StrErr, []float64{10, 10, 0}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat64StrErr failed")
}
expectedList = []string{"10", "10"}
newList, _ = PMapFloat64StrErr(someLogicFloat64StrErr, []float64{10, 10}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapFloat64Str failed")
}
_, err = PMapFloat64StrErr(someLogicFloat64StrErr, []float64{10, 10, 0}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64StrErr failed")
}
_, err = PMapFloat64StrErr(someLogicFloat64StrErr, []float64{10, 10, 0}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64StrErr failed")
}
_, err = PMapFloat64StrErr(someLogicFloat64StrErr, []float64{0, 0, 10}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64StrErr failed")
}
_, err = PMapFloat64StrErr(someLogicFloat64StrErr, []float64{0, 10, 0}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64StrErr failed")
}
_, err = PMapFloat64StrErr(someLogicFloat64StrErr, []float64{10, 10, 0}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64StrErr failed")
}
}
func TestPmapFloat64BoolErr(t *testing.T) {
// Test : someLogic
expectedList := []bool{true, false}
newList, _ := PMapFloat64BoolErr(someLogicFloat64BoolErr, []float64{10, 0})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapFloat64BoolErr failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapFloat64BoolErr(nil, nil)
if len(r) > 0 {
t.Errorf("PMapFloat64BoolErr failed")
}
r, _ = PMapFloat64BoolErr(nil, []float64{})
if len(r) > 0 {
t.Errorf("PMapFloat64BoolErr failed")
}
_, err := PMapFloat64BoolErr(someLogicFloat64BoolErr, []float64{10, 3, 3})
if err == nil {
t.Errorf("PMapFloat64BoolErr failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapFloat64BoolErr(someLogicFloat64BoolErr, []float64{10, 10, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat64BoolErr failed")
}
_, err = PMapFloat64BoolErr(someLogicFloat64BoolErr, []float64{3, 3, 10}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapFloat64BoolErr failed")
}
_, err = PMapFloat64BoolErr(someLogicFloat64BoolErr, []float64{3, 10, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat64BoolErr failed")
}
_, err = PMapFloat64BoolErr(someLogicFloat64BoolErr, []float64{10, 10, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat64BoolErr failed")
}
expectedList = []bool{true, true}
newList, _ = PMapFloat64BoolErr(someLogicFloat64BoolErr, []float64{10, 10}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapFloat64Bool failed")
}
_, err = PMapFloat64BoolErr(someLogicFloat64BoolErr, []float64{10, 10, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64BoolErr failed")
}
_, err = PMapFloat64BoolErr(someLogicFloat64BoolErr, []float64{10, 10, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64BoolErr failed")
}
_, err = PMapFloat64BoolErr(someLogicFloat64BoolErr, []float64{3, 3, 10}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64BoolErr failed")
}
_, err = PMapFloat64BoolErr(someLogicFloat64BoolErr, []float64{3, 10, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64BoolErr failed")
}
_, err = PMapFloat64BoolErr(someLogicFloat64BoolErr, []float64{10, 10, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64BoolErr failed")
}
}
func TestPmapFloat64Float32Err(t *testing.T) {
// Test : add 1 to the list
expectedList := []float32{2, 3}
newList, _ := PMapFloat64Float32Err(plusOneFloat64Float32Err, []float64{1, 2})
if newList[0] != expectedList[0] || newList[1] != expectedList[1] {
t.Errorf("PMapFloat64Float32 failed. expected=%v, actual=%v", expectedList, newList)
}
r, _ := PMapFloat64Float32Err(nil, nil)
if len(r) > 0 {
t.Errorf("PMapFloat64Float32Err failed")
}
r, _ = PMapFloat64Float32Err(nil, []float64{})
if len(r) > 0 {
t.Errorf("PMapFloat64Float32Err failed")
}
_, err := PMapFloat64Float32Err(plusOneFloat64Float32Err, []float64{1, 2, 3})
if err == nil {
t.Errorf("PMapFloat64Float32Err failed")
}
reflect.TypeOf("Nandeshwar") // Leaving it here to make use of import reflect
_, err = PMapFloat64Float32Err(plusOneFloat64Float32Err, []float64{3, 3, 2}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat64Float32Err failed")
}
_, err = PMapFloat64Float32Err(plusOneFloat64Float32Err, []float64{3, 3, 2}, Optional{FixedPool: 2})
if err == nil {
t.Errorf("PMapFloat64Float32Err failed")
}
_, err = PMapFloat64Float32Err(plusOneFloat64Float32Err, []float64{3, 1, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat64Float32Err failed")
}
_, err = PMapFloat64Float32Err(plusOneFloat64Float32Err, []float64{1, 2, 3}, Optional{FixedPool: 1})
if err == nil {
t.Errorf("PMapFloat64Float32Err failed")
}
expectedList = []float32{2, 3}
newList, _ = PMapFloat64Float32Err(plusOneFloat64Float32Err, []float64{1, 2}, Optional{RandomOrder: true})
counter := 0
for i := 0; i < len(expectedList); i++ {
for j := 0; j < len(newList); j++ {
if expectedList[i] == newList[j] {
counter++
break
}
}
}
if counter != len(expectedList) {
t.Errorf("PMapFloat64Float32 failed")
}
_, err = PMapFloat64Float32Err(plusOneFloat64Float32Err, []float64{1, 2, 3}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64Float32Err failed")
}
_, err = PMapFloat64Float32Err(plusOneFloat64Float32Err, []float64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64Float32Err failed")
}
_, err = PMapFloat64Float32Err(plusOneFloat64Float32Err, []float64{3, 3, 1}, Optional{FixedPool: 1, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64Float32Err failed")
}
_, err = PMapFloat64Float32Err(plusOneFloat64Float32Err, []float64{3, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64Float32Err failed")
}
_, err = PMapFloat64Float32Err(plusOneFloat64Float32Err, []float64{1, 2, 3}, Optional{FixedPool: 2, RandomOrder: true})
if err == nil {
t.Errorf("PMapFloat64Float32Err failed")
}
}
|
<gh_stars>0
package bolum06;
import java.util.Scanner;
/*
(Geometry: point position) Programming Exercise 3.32 shows how to test whether
a point is on the left side of a directed line, on the right, or on the same line.
*/
public class Cozum_06_39 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("Points : ");
double x0 = sc.nextDouble();
double y0 = sc.nextDouble();
double x1 = sc.nextDouble();
double y1 = sc.nextDouble();
double x2 = sc.nextDouble();
double y2 = sc.nextDouble();
if (leftOfTheLine(x0, y0, x1, y1, x2, y2)) {
System.out.println("on the left side of the line.");
}
if (onTheLineSegment(x0, y0, x1, y1, x2, y2)) {
System.out.println("on the same line from.");
}
if (onTheSameLine(x0, y0, x1, y1, x2, y2)) {
System.out.println("on the right side of the line.");
}
}
/**
* Return true if point (x2, y2) is on the left side of the
* directed line from (x0, y0) to (x1, y1)
*/
public static boolean leftOfTheLine(double x0, double y0,
double x1, double y1, double x2, double y2) {
return (x1 - x0) * (y2 - y0) - (x2 - x0) * (y1 - y0) > 0;
}
/**
* Return true if point (x2, y2) is on the same
* line from (x0, y0) to (x1, y1)
*/
public static boolean onTheSameLine(double x0, double y0,
double x1, double y1, double x2, double y2) {
return (x1 - x0) * (y2 - y0) - (x2 - x0) * (y1 - y0) == 0;
}
/**
* Return true if point (x2, y2) is on the
* line segment from (x0, y0) to (x1, y1)
*/
public static boolean onTheLineSegment(double x0, double y0,
double x1, double y1, double x2, double y2) {
return (x1 - x0) * (y2 - y0) - (x2 - x0) * (y1 - y0) < 0;
}
} |
#pragma once
#include <math.h>
#include "Shape.hpp"
#include "Triangle.hpp"
#include "Point.hpp"
#include "Line.hpp"
#include "Circle.hpp"
#include "Rectangle.hpp"
#include "MathFunctions.hpp"
#include "../TrollCollision/CollisionManager.hpp"
#include "ShapeList.hpp"
//! Everything in this module is in the namespace TMath;
/*
when a object is generated a function will return a normal pointer, when you call a method such as get_center()
that returns a point it will be a const pointer to the point object.
Methods that return a pointer should be checked before using with somthing like if(return_stuff()).
sub-shapes such as the rectangle, and circle are mostly just data containers
*/
|
/**
* Created by bruce on 1/27/16.
*/
@Entity
@Table(schema="public",name = "passcode_record")
public class JpaPasscodeRecord {
@Id
@GeneratedValue
@Column(name = "passcode_record_id")
private Long passcodeRecordId;
@Column(name = "value", nullable = false)
private String value;
@Column(name = "user_id", nullable = true, length = 100)
private String userId;
@Column(name="test_event_id", nullable=true)
private Integer testEventId;
@Column(name = "type", nullable = false)
@Enumerated(EnumType.ORDINAL)
private PasscodeType type;
@Column(name = "create_date", nullable = false)
@Temporal(TemporalType.TIMESTAMP)
private Calendar createDate;
public JpaPasscodeRecord() {
}
public JpaPasscodeRecord(Passcode passcode) {
setValue(passcode.getValue());
setType(passcode.getType());
setUserId(passcode.getUserId());
setCreateDate(passcode.getCreateDate());
}
public JpaPasscodeRecord(JpaTestEvent testEvent) {
setValue(testEvent.getRemotePasscode());
setTestEventId(testEvent.getTestEventId());
setCreateDate(new GregorianCalendar());
setType(PasscodeType.REMOTE); //TODO refactor validation, this was added as part of the refactor to microservices
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public PasscodeType getType() {
return type;
}
public void setType(PasscodeType type) {
this.type = type;
}
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public Integer getTestEventId() {
return testEventId;
}
public void setTestEventId(Integer testEventId) {
this.testEventId = testEventId;
}
public Calendar getCreateDate() {
return createDate;
}
public void setCreateDate(Calendar createDate) {
this.createDate = createDate;
}
public String toString() {
return ReflectionToStringBuilder.reflectionToString(this);
}
} |
// Copyright 2020 ETH Zurich, Anapaya Systems
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package stateless
import (
"context"
"math"
base "github.com/scionproto/scion/go/co/reservation"
"github.com/scionproto/scion/go/co/reservation/segment"
"github.com/scionproto/scion/go/co/reservation/segment/admission"
"github.com/scionproto/scion/go/co/reservationstorage/backend"
"github.com/scionproto/scion/go/lib/addr"
"github.com/scionproto/scion/go/lib/colibri/reservation"
"github.com/scionproto/scion/go/lib/serrors"
)
// StatelessAdmission can admit a segment reservation without any state other than the DB.
type StatelessAdmission struct {
Caps base.Capacities // aka capacity matrix
Delta float64 // fraction of free BW that can be reserved in one request
}
var _ admission.Admitter = (*StatelessAdmission)(nil)
func (a *StatelessAdmission) Capacities() base.Capacities {
return a.Caps
}
// AdmitRsv admits a segment reservation. The request will be modified with the allowed and
// maximum bandwidths if they were computed. It can also return an error that must be checked.
func (a *StatelessAdmission) AdmitRsv(ctx context.Context, x backend.ColibriStorage,
req *segment.SetupReq) error {
avail, err := a.availableBW(ctx, x, *req)
if err != nil {
return serrors.WrapStr("cannot compute available bandwidth", err, "segment_id", req.ID)
}
ideal, err := a.idealBW(ctx, x, *req)
if err != nil {
return serrors.WrapStr("cannot compute ideal bandwidth", err, "segment_id", req.ID)
}
maxAlloc := reservation.BWClsFromBW(minBW(avail, ideal))
bead := reservation.AllocationBead{
AllocBW: reservation.MinBWCls(maxAlloc, req.MaxBW),
MaxBW: maxAlloc,
}
req.AllocTrail = append(req.AllocTrail, bead)
if maxAlloc < req.MinBW {
return serrors.New("admission denied", "maxalloc", maxAlloc, "minbw", req.MinBW,
"segment_id", req.ID.String())
}
return nil
}
func (a *StatelessAdmission) availableBW(ctx context.Context, x backend.ColibriStorage,
req segment.SetupReq) (uint64, error) {
ingress := req.Ingress()
sameIngress, err := x.GetSegmentRsvsFromIFPair(ctx, &ingress, nil)
if err != nil {
return 0, serrors.WrapStr("cannot get reservations using ingress", err,
"ingress", ingress)
}
egress := req.Egress()
sameEgress, err := x.GetSegmentRsvsFromIFPair(ctx, nil, &egress)
if err != nil {
return 0, serrors.WrapStr("cannot get reservations using egress", err,
"egress", egress)
}
bwIngress := sumMaxBlockedBW(sameIngress, req.ID)
freeIngress := a.Caps.CapacityIngress(ingress) - bwIngress
bwEgress := sumMaxBlockedBW(sameEgress, req.ID)
freeEgress := a.Caps.CapacityEgress(egress) - bwEgress
// `free` excludes the BW from an existing reservation if its ID equals the request's ID
free := float64(minBW(freeIngress, freeEgress))
return uint64(free * a.Delta), nil
}
func (a *StatelessAdmission) idealBW(ctx context.Context, x backend.ColibriStorage,
req segment.SetupReq) (uint64, error) {
tubeRatio, err := a.tubeRatio(ctx, x, req)
if err != nil {
return 0, serrors.WrapStr("cannot compute tube ratio", err)
}
linkRatio, err := a.linkRatio(ctx, x, req)
if err != nil {
return 0, serrors.WrapStr("cannot compute link ratio", err)
}
cap := float64(a.Caps.CapacityEgress(req.Egress()))
return uint64(cap * tubeRatio * linkRatio), nil
}
func (a *StatelessAdmission) tubeRatio(ctx context.Context, x backend.ColibriStorage,
req segment.SetupReq) (float64, error) {
transitDemand, err := a.transitDemand(ctx, x, req.Ingress(), req)
if err != nil {
return 0, serrors.WrapStr("cannot compute tube ratio", err)
}
capIn := a.Caps.CapacityIngress(req.Ingress())
numerator := minBW(capIn, transitDemand)
var sum uint64
for _, in := range a.Caps.IngressInterfaces() {
dem, err := a.transitDemand(ctx, x, in, req)
if err != nil {
return 0, serrors.WrapStr("cannot compute tube ratio", err)
}
sum += minBW(a.Caps.CapacityIngress(in), dem)
}
if sum == 0 || numerator == 0 {
return 1, nil
}
return float64(numerator) / float64(sum), nil
}
func (a *StatelessAdmission) linkRatio(ctx context.Context, x backend.ColibriStorage,
req segment.SetupReq) (float64, error) {
rsvs, err := x.GetAllSegmentRsvs(ctx)
if err != nil {
return 0, serrors.WrapStr("computing transit demand failed", err)
}
grouped := groupRsvsBySource(rsvs)
if _, found := grouped[req.ID.ASID]; !found {
// because srcAlloc needs to be called w/ the source for the request, and in the
// DB there were none, add a group with that source and 0 reservations from the DB:
grouped[req.ID.ASID] = make([]*segment.Reservation, 0)
}
egScalFctr := a.egScalFctr(grouped[req.ID.ASID], req.Egress(), req)
numerator := egScalFctr * float64(req.PrevBW())
var denom float64
for src, rsvs := range grouped {
egScalFctr = a.egScalFctr(rsvs, req.Egress(), req)
srcAlloc := a.srcAlloc(rsvs, src, req.Ingress(), req.Egress(), req)
denom += egScalFctr * float64(srcAlloc)
}
if denom == 0 {
return 1, nil
}
return numerator / denom, nil
}
// transitDemand computes the transit demand from ingress to req.Egress .
func (a *StatelessAdmission) transitDemand(ctx context.Context, x backend.ColibriStorage,
ingress uint16, req segment.SetupReq) (uint64, error) {
rsvs, err := x.GetAllSegmentRsvs(ctx)
if err != nil {
return 0, serrors.WrapStr("computing transit demand failed", err)
}
grouped := groupRsvsBySource(rsvs)
var sum uint64
for _, rsvs := range grouped {
dem := a.adjSrcDem(rsvs, ingress, req.Egress(), req)
sum += dem
}
return sum, nil
}
// adjSrcDem computes the adjusted source demand.
// Parameter `rsvs` is all the reservations with the same source.
// There is no need for a source parameter, as it's not used.
func (a *StatelessAdmission) adjSrcDem(rsvs []*segment.Reservation, ingress, egress uint16,
req segment.SetupReq) uint64 {
scalFctr := math.Min(a.inScalFctr(rsvs, ingress, req), a.egScalFctr(rsvs, egress, req))
srcDem := a.srcDem(rsvs, ingress, egress, req)
return uint64(scalFctr * float64(srcDem))
}
// inScalFctr takes rsvs as all the reservations with the same source
func (a *StatelessAdmission) inScalFctr(rsvs []*segment.Reservation, ingress uint16,
req segment.SetupReq) float64 {
capIn := a.Caps.CapacityIngress(ingress)
inDem := a.inDem(rsvs, ingress, req)
if inDem == 0 {
return 1
}
return float64(minBW(capIn, inDem)) / float64(inDem)
}
// egScalFctr takes rsvs as all the reservations with the same source
func (a *StatelessAdmission) egScalFctr(rsvs []*segment.Reservation, egress uint16,
req segment.SetupReq) float64 {
capEg := a.Caps.CapacityEgress(egress)
egDem := a.egDem(rsvs, egress, req)
if egDem == 0 {
return 1
}
return float64(minBW(capEg, egDem)) / float64(egDem)
}
func (a *StatelessAdmission) inDem(rsvs []*segment.Reservation, ingress uint16,
req segment.SetupReq) uint64 {
var inDem uint64
for _, eg := range a.Caps.EgressInterfaces() {
inDem += a.srcDem(rsvs, ingress, eg, req)
}
return inDem
}
func (a *StatelessAdmission) egDem(rsvs []*segment.Reservation, egress uint16,
req segment.SetupReq) uint64 {
var egDem uint64
for _, in := range a.Caps.IngressInterfaces() {
egDem += a.srcDem(rsvs, in, egress, req)
}
return egDem
}
// srcDem computes the source demand. Parameter `rsvs` are all reservations with same source.
func (a *StatelessAdmission) srcDem(rsvs []*segment.Reservation, ingress, egress uint16,
req segment.SetupReq) uint64 {
capIn := a.Caps.CapacityIngress(ingress)
capEg := a.Caps.CapacityEgress(req.Egress())
var srcDem uint64
for _, r := range rsvs {
if r.Ingress == ingress && r.Egress == egress && !r.ID.Equal(&req.ID) {
capReqDem := minBW(capIn, capEg, a.reqDem(*r, req))
srcDem += capReqDem
}
}
// lastly, add the request demand from the request itself
if len(rsvs) > 0 && req.ID.ASID == rsvs[0].ID.ASID &&
req.Ingress() == ingress && req.Egress() == egress {
capReqDem := minBW(capIn, capEg, req.MaxBW.ToKbps())
srcDem += capReqDem
}
return srcDem
}
func (a *StatelessAdmission) reqDem(r segment.Reservation, req segment.SetupReq) uint64 {
var bw uint64
if r.ID.Equal(&req.ID) {
bw = req.MaxBW.ToKbps()
} else {
bw = r.MaxRequestedBW()
}
return bw
}
// srcAlloc computes how much bandwidth is allocated between ingress and egress, for
// a given source `source`. All reservations in `rsvs` are from `source`.
func (a *StatelessAdmission) srcAlloc(rsvs []*segment.Reservation, source addr.AS,
ingress, egress uint16, req segment.SetupReq) uint64 {
var sum uint64
for _, r := range rsvs {
if r.Ingress == ingress && r.Egress == egress {
if !r.ID.Equal(&req.ID) {
sum += r.MaxBlockedBW()
}
}
}
if source == req.ID.ASID {
sum += req.PrevBW()
}
return sum
}
// sumMaxBlockedBW adds up all the max blocked bandwidth by the reservation, for all reservations,
// iff they don't have the same ID as "excludeThisRsv".
func sumMaxBlockedBW(rsvs []*segment.Reservation, excludeThisRsv reservation.ID) uint64 {
var total uint64
for _, r := range rsvs {
if !r.ID.Equal(&excludeThisRsv) {
total += r.MaxBlockedBW()
}
}
return total
}
func minBW(a uint64, bws ...uint64) uint64 {
min := a
for _, bw := range bws {
if bw < min {
min = bw
}
}
return min
}
func groupRsvsBySource(rsvs []*segment.Reservation) map[addr.AS][]*segment.Reservation {
grouped := make(map[addr.AS][]*segment.Reservation)
for _, rsv := range rsvs {
source := rsv.ID.ASID
grouped[source] = append(grouped[source], rsv)
}
return grouped
}
|
package io.pivotal.cf.tester.service;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Supplier;
import javax.annotation.PostConstruct;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.dao.NonTransientDataAccessException;
import org.springframework.data.redis.core.BoundSetOperations;
import org.springframework.data.redis.core.BoundZSetOperations;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import io.pivotal.cf.tester.util.UtilBean;
@Component
public class ConsistencyChecker {
private static Logger log = LoggerFactory.getLogger(ConsistencyChecker.class);
@Autowired
private UtilBean utils;
@Autowired(required=false)
private RedisTemplate< String, Long > redisTemplate;
@Value("${time.since:3000}")
private long timeSince = 3000;
@Value("${rabbit.publishers:1}")
private int numPublishers = 1;
@Value("${rabbit.consumer.instances:1}")
private int numConsumers = 1;
@Autowired
private StateService stateService;
private AtomicInteger instanceIdCounter = new AtomicInteger(0);
private ThreadLocal<Integer> instanceIndex = ThreadLocal.withInitial(new Supplier<Integer>() {
@Override
public Integer get() {
return instanceIdCounter.getAndIncrement();
}
});
@PostConstruct
void init() {
try {
for(int i=0; i<numPublishers; i++) {
redisTemplate.delete(utils.getPublishedKey(i));
redisTemplate.delete(utils.getPublishedZKey(i));
}
}
catch(NonTransientDataAccessException ex) {
log.error("Redis is not available. Is it down?");
}
}
/**
* Save the message id and the timestamp when it has been
* published as a score to the Redis ZSET
*
* @param messageId
*/
@HystrixCommand(fallbackMethod="saveToRedisFallback")
public void saveToRedis(long messageId) {
if(redisTemplate == null) {
log.debug("Redis Service unavailable");
stateService.setRedisDown();
return;
}
long time = new Date().getTime();
redisTemplate.boundZSetOps( utils.getPublishedZKey(instanceIndex.get()) )
.add(messageId, time);
redisTemplate.boundSetOps( utils.getPublishedKey(instanceIndex.get()) )
.add(messageId);
stateService.setRedisUp();
}
public void saveToRedisFallback(long messageId) {
log.warn("Saving of [{}] to Redis has failed", messageId);
stateService.setRedisDown();
}
public int getIndex() {
return instanceIndex.get();
}
/**
* Finds message IDs in the Redis store for which no response from consumers
* has arrived since the configured timeout value
*/
@Scheduled(fixedRateString="${consistemncy.checker.rate:1000}")
public void checkDeliveredMessages() {
if( redisTemplate == null ) {
return;
}
try {
for(int i=0; i<numPublishers; i++) {
Date checkTime = new Date();
long checkTimeLong = checkTime.getTime();
long checkSince = checkTimeLong - timeSince;
BoundZSetOperations<String, Long> publishedZSetOps = redisTemplate.boundZSetOps(utils.getPublishedZKey(i));
BoundSetOperations<String, Long> publishedSetOps = redisTemplate.boundSetOps(utils.getPublishedKey(i));
// Get the ids of the messages published longer than timeout to
// wait for their reception
Set<Long> oldPublishedIds = publishedZSetOps.rangeByScore(0, checkSince);
Set<Long> oldUnrespondedIds = new HashSet<>( oldPublishedIds );
for(int j=0; j<numConsumers; j++) {
log.debug("Checking messages published by {} at {} {} ({}) since ({})",
utils.getPublishedKey(i), utils.getReceivedKey(j), checkTime, checkTimeLong, checkSince);
BoundSetOperations<String, Long> receivedSetOps = redisTemplate.boundSetOps(utils.getReceivedKey(j));
// Get the Set difference between all published ID minus all responded ids
Set<Long> unresponded = publishedSetOps.diff( utils.getReceivedKey(j) );
// Filter out recent IDs for which the timeout hasn't fired yet
oldUnrespondedIds.retainAll(unresponded);
if( !oldUnrespondedIds.isEmpty() ) {
log.error("NO RESPONSE in {} FOR {} MESSAGES: {}",
utils.getReceivedKey(j), utils.getPublishedKey(i), oldPublishedIds);
}
// Clean old checked records
receivedSetOps.remove(oldPublishedIds);
}
publishedZSetOps.removeRangeByScore(0, checkSince);
publishedSetOps.remove(oldPublishedIds);
}
}
catch(Exception ex) {
log.warn("Consistency could not be checked: {}", ex.getMessage());
}
}
}
|
def to_bytestr(self):
flattened = list()
for component in ["harvesting", "load", "emulation"]:
for channel in ["voltage", "current"]:
for parameter in ["gain", "offset"]:
flattened.append(self._data[component][channel][parameter])
return struct.pack(">dddddddddddd", *flattened) |
Antibiotic and analgesic residues in the environment – Occurrence and ecological risk study from the Sunyani municipality, Ghana
The presence of five antibiotics (metronidazole, ciprofloxacin, amoxicillin, doxycycline, and chloramphenicol) and four analgesics (diclofenac, ibuprofen, paracetamol, and caffeine) were investigated in water and soil samples from the Sunyani municipality, Ghana. Liquid samples were collected from hospital effluents, sachet drinking water, municipal waterworks, river Tano, and dumpsite leachates, while soil samples were collected from dumpsites and municipal waterworks. All samples were prepared using solid-phase extraction (SPE) and analyzed via an HPLC- PDA method. All antibiotics analyzed, apart from metronidazole, were detected either in soil or water samples. Doxycycline and ciprofloxacin were present in almost all liquid samples. The investigated hospital effluents had antibiotic concentrations of up to 2.93 mg/L for doxycycline and 4.74 mg/L for ciprofloxacin. The highest concentration of any antibiotic found was 8.76 mg/L of amoxicillin in hospital effluents. The maximum concentration of analgesics in liquid samples analyzed was 3.20 mg/L (paracetamol) and 3.00 mg/kg (caffeine) in soil samples. Ecological risk assessment indicated that the pharmaceuticals pose a possible risk to some aquatic organisms. The findings from this study showed the presence of these pharmaceuticals at concentrations that could impact the ecosystem. Consistent monitoring of environmental levels and pursuing the development and implementation of a suitable remediation program is needed.
Introduction
Public health care is achieved mainly by the use of pharmaceuticals . Thousands of diverse pharmaceutically active compounds are used in huge quantities to prevent or treat human and animal diseases. Analgesics and antibiotics are among the most prescribed drugs worldwide . The relevance of analgesics cannot be overlooked as far as pain relief is concerned. On the other hand, antibiotics are used to inhibit the growth of bacteria or kill them. These pharmaceuticals, especially analgesics, are in high demand on the market and can be bought over-the-counter without a prescription . The total annual market consumption of antibiotics worldwide is estimated to lie between 100, 000 and 200,000 tons . Non-steroidal anti-inflammatory drugs (NSAIDs) are among the most frequently used drugs worldwide, consumed by more than 30 million people daily . In the USA, an annual prescription of over 111 million NSAIDs are consumed, and this represents about 60% of the USA's over the counter analgesic market .
Antibiotics and analgesics are indispensable in modern medicine. However, the extensive use of these pharmaceuticals has led to their presence and persistence in environmental matrices which can result in the development of drug resistance -a global concern. About 40-90% of pharmaceuticals administered are excreted in feces and urine as parent compounds (in the active form) into the environment . Pharmaceuticals ultimately find their way into the environment through runoffs, leaks, and sewage systems, and these could contaminate soils, water bodies, and plants . The use of huge amounts of pharmaceuticals in animal farming can result in agro-ecosystem contamination. This occurs when contaminated manure is applied on agricultural lands as fertilizer and crops are irrigated with wastewater. Another route through which pharmaceuticals enter the environment is improper disposal of unused pharmaceuticals. Pharmaceuticals also enter the environment by discharging industrial effluent, hospital effluent, sewage treatment plants, and septic tanks into streams and rivers .
Lately, pharmaceuticals have become micro-contaminants in soil and water as the rate of their introduction in the environment surpasses degradation . Analgesics and antibiotics are among the most widely detected pollutants in the environment and are, hence, considered pseudo-persistent contaminants . The negative impact of antibiotics on natural microbial communities could include the bactericidal and bacteriostatic actions of antibiotics. These actions cause the loss or destruction of some microbial groups involved in crucial ecosystem activities (direct effect) . Exposure of oriental white-backed vultures to analgesics (diclofenac) has been shown to affect their kidney and thus resulting in kidney failure. This is reported to have led to a decline in vulture population and extinction in some parts of the world .
Pharmaceuticals have been detected in samples from dumpsites , hospital effluents , surface water , and drinking water all over the world. It has been noted that unwanted or expired medicines are most commonly thrown into trash cans or disposed of alongside household waste . A study conducted on landfill sites in Kumasi, Ghana, reported high concentrations of up to 18.25 ± 7.92 mg/L for metronidazole and 10.96 ± 6.93 mg/L for amoxicillin in leachate samples .
It is reported that about 25-68% of antibiotics are administered to hospitalized patients worldwide. That number is even higher in Ghana, where about 71% of hospitalized patients receive antibiotics as part of their treatment regimen . Several studies have reported pharmaceutical residues in drinking water due to runoffs from industries sewage, hospitals effluents, leachates from dumpsites, etc., which end up in water bodies. This makes rivers and drinking water samples possible hotspots as well. Pharmaceuticals have been detected in food, hospital effluents, dumpsite leachates, surface and drinking water in some parts of Ghana . However, the residual concentrations, occurrence, and ecological effects of antibiotics and analgesics in the Sunyani Municipality are obscure. The purpose of this work was to investigate the occurrence of two classes of pharmaceuticals (antibiotics and analgesics) in hospital effluents, dumpsite soil and leachates, sachet water, and municipal waterworks samples and to investigate the risks associated with the presence of these pharmaceuticals in both water and soil samples.
Reagents
Acetonitrile (HPLC grade) and methanol (Analytical grade) were obtained from VWR Chemicals (Accra, Ghana). Antibiotics (amoxicillin, chloramphenicol, metronidazole, doxycycline ciprofloxacin) and analgesics (paracetamol, caffeine, diclofenac, ibuprofen) standards were obtained as pure powders from Ernest Chemists (Accra, Ghana). Deionized water was used to prepare all solutions and calibration standards for HPLC analysis. Stock solutions of 1000 mg/L of each analyte were prepared. Working standard solutions were prepared from the stock standard solutions for both antibiotics and analgesics.
Study area
A map of the Sunyani municipality is shown in Fig. 1. Sunyani is known as the green city of Ghana and is the capital town of the Bono Region, Ghana. The Sunyani municipality is one of the Bono Region's 12 districts. Sunyani is inhabited by 152,567 people. A total of 125 retail pharmacies and 41 hospitals/health centers provides medical assistance in the region . River Tano, the main source of water in the Sunyani Municipality, is located at Tanoso in the Bono Region. It is directed into a reservoir at the Sunyani Municipal waterworks station. At the station, it passes through different channels created (settled water chamber, final water chamber) for treatment and purification before it is distributed to various reception points.
Soil samples
Soil and sediment samples were collected (0-20 cm depth) from dumpsites and the municipal waterworks station in the Sunyani Municipality using a stratified random sampling approach in September 2020.
Liquid samples
Pre-cleaned plastic bottles (1.5 L) were rinsed with each water sample to be collected before samples were fetched into the bottles. Dumpsite leachates, hospital effluents, water samples from the Sunyani Municipal waterworks station and River Tano were sampled for the study. Samples were collected about 10-20 cm deep within the banks of River Tano (latitude: 6.729490, longitude: − 2.424003). Water samples were also taken from different reservoirs at the waterworks station. Different sachet drinking water sold in the Sunyani municipality was also sampled for analysis. In all, 60 water and 52 soil samples were collected. All the samples collected were labeled and packed into boxes and transported frozen in ice-chests maintained at 4 • C to the laboratory for analysis. In the laboratory, pH, total dissolved solids (TDS), and electrical conductivity (EC) were measured for all water and soil samples using procedures described elsewhere .
Soil
Soil/sediment samples were air-dried at room temperature. After drying, all samples from each site were mixed to form a composite. The samples were ground with mortar and pestle, sieved using a 200 µm mesh sieve into fine particles to ensure homogeneity, and then put into Ziplock bags.
Sonication and filtration
One hundred milliliters of acetonitrile was added to a 50 g soil sample, shaken vigorously, and allowed to stand overnight. The samples were sonicated in an ultrasonicator bath (VWR USC 600 T, 45 kHz, 120 W) for about 15 min the next day and centrifuged at 25 • C. The supernatant was decanted. Another 50 mL of acetonitrile was added to the sample and sonicated for 30 min. The supernatants were combined and successively filtered first with cotton wool and finally with Whatman 125 mm filter paper to obtain clear solutions prior to solid-phase extraction (SPE) .
Water and leachates
Solid impurities were removed from water and leachate samples by filtration, successively with cotton wool and Whatman 125 mm filter papers. Leachate samples that still had particles were centrifuged at 2000 rpm for 10 min at 25 • C to get the particles to settle, and the supernatants were then decanted. The filtered samples were then subjected to SPE .
Liquid samples
A hydrophilic-lipophilic balance cartridge (HLB 6 mL, 200 mg, 30 µm) was used. The SPE cartridges were conditioned with 5 mL methanol (MeOH) followed by 5 mL distilled water. Six hundred milliliter portions of liquid samples were loaded onto SPE cartridges at a flow rate of 1.5 mL/min. The cartridges were allowed to dry for a couple of minutes under vacuum. Analytes were eluted from the cartridges with 3 mL MeOH after washing with 3 mL water. Eluates were transferred into 2 mL autosampler HPLC vials for analysis .
Soil samples
For soil samples, the SPE cartridges were conditioned with 5 mL of methanol (MeOH) followed by 5 mL of distilled water. The combined filtrate from the extraction (100 mL) was loaded onto SPE cartridges at a flow rate of 1.5 mL/min and left to dry for a couple of minutes. The dried SPE cartridges were washed with 5 mL distilled water and then dried under vacuum for about 10 min. The sorbents were eluted with 3 mL methanol. Samples were then transferred to 2 mL autosampler HPLC vials for analysis .
HPLC analysis
Chromatographic separation was done on a Perkin Elmer Flexar HPLC coupled to a PDA detector. Antibiotics separation was attained on Agilent Zorbax 300SB C18 (250 ×4.6 mm, 5 µm) column. The mobile phase consisted of 0.05% TFA (A) and methanol (B). Separation of analgesics was achieved on a Phenomenex Luna C8 (150 ×4.6 mm, 5 µm) column. The mobile phase for analgesic separation consisted of 0.1% acetic acid (A) and methanol (B). Tables 1 and 2 give the detailed gradient program from the gradient elution performed at a flow rate of 1 mL/min with an injection volume of 20 µL for both antibiotics and analgesics.
The total runtime for the analysis was 18 min for antibiotics and 22 min for analgesics, and all chromatographic work was carried out at ambient temperatures. Detection of metronidazole, ciprofloxacin, and doxycycline was at 320 nm and amoxicillin and chloramphenicol at 215 nm. Paracetamol and caffeine were monitored at 270 nm, Table 1 HPLC flow program for antibiotics residue analysis. Step Step Type Step diclofenac, and ibuprofen at 220 nm. Quantification was done using external calibration and peak area measurement.
LOD and LOQ
Linearity was established for all test samples in concentrations ranging from 0.2 to 10 mg/. The limits of detection (LOD) and limits of quantification (LOQ) for each test sample were calculated with respect to signal-to-noise ratios.
Recoveries and quality assurance
A sample blank (water and soil matrices containing none of the analytes) was prepared and spiked with known concentrations of standard drugs. After the extraction and SPE clean-up procedures (as described earlier), the sample blank was analyzed by HPLC methods described earlier. The concentration of the drugs was determined from the chromatograms obtained. Standard solutions of the analytes were injected prior to analyses and after every 10 sample runs to ensure that the HPLC system was functioning properly. Blank samples were also injected after every 5 runs to monitor any sample interference. All sample injections were made in duplicates. Each batch of analyses was prepared to include a reagent blank to check background contamination . Table 3 shows the recovery data of antibiotics and analgesics.
Ecological risk assessment
The risk that the presence of various pharmaceuticals in the environment poses was estimated using the Risk Quotient (RQ) as suggested by the European Medicines Evaluation Agency (EMEA, 2006). The ecological risk quotient (RQ) was calculated for each antibiotic and analgesic using the ratio between the maximal environmental concentrations (MEC) and predicted no-effect concentration (PNEC), as shown in equation 1.
RQ was calculated at different trophic levels of the ecosystem (algae, daphnid, fish, crustaceans). RQ < 0.1 indicates a minimal risk to aquatic organisms; 0.1 ≤ RQ ≤ 1.0 poses a medium risk and RQ ≥ 1.0, poses a possibly high risk and is likely to harm organisms in the environment .
Results
The physicochemical parameters of the liquid and soil samples are presented in Table 4. Generally, water samples from the Sunyani municipal waterworks station were slightly acidic (pH range of 6.01-6.79). Sediment samples from the same station were slightly acidic to slightly basic (pH range of 5.92-7.63). Leachates and soil samples from dumpsites were slightly acidic (6.34-6.90) and slightly acidic to slightly basic (5.82 -7.79), respectively. The pH of sachet water samples and hospital effluents ranged from 6.02 to 6.44 and 6.55-7.33, respectively. The total dissolved solids (TDS) values of all water and sediment samples from Sunyani municipal waterworks station ranged from 152.00 to 185.12 mg/L and 29.00 -77.00 mg/L, respectively. TDS for leachates and soil samples from dumpsite were generally high, ranging from 230.00 to 1323.00 mg/L and 73.00 -475.00 mg/L, respectively. Low TDS values ranging from 9.00 to 55.00 mg/L were recorded in sachet water samples and hospital effluents (161.00-1121.00 mg/L). The Electrical Conductivity (EC) of all water and sediment samples from Sunyani municipal waterworks station were in the range of 152.30 -220.00 µS/cm and 31.60 -86.00 µS/cm, respectively. The EC for leachates and soil samples from dumpsite were generally high (390.00 -6557.25 µS/cm and 79.80 -519.00 µS/cm, respectively). The lowest EC values were recorded in sachet water samples (9.25 -57.75 µS/cm), with the EC for hospital effluents ranging from 187.15 to 1141.00 µS/ cm.
Occurrence of antibiotics and analgesics in water matrices
Of the 5 antibiotics analyzed, 4 were detected in at least one of the matrices. For analgesics, all target analytes were detected in either of the samples. The summary of the occurrence and concentration of antibiotics (liquid and solid samples), analgesics (liquid and solid samples), and the summary of the concentrations of both antibiotics and analgesics in liquid and solid samples are shown in Tables 5 and 6.
Occurrence of antibiotics in liquid samples
For antibiotics, none of the target analytes were detected in sachet drinking water and municipal waterworks samples ( Table 5). The concentrations of antibiotics in leachate samples are shown in (Table 5). Apart from amoxicillin, all target antibiotics were detected in the leachate samples. Antibiotics concentrations ranged between 0.25 mg/L to 1.91 mg/L for ciprofloxacin, 1.78 mg/L to 2.22 mg/L for doxycycline and 2.29 mg/L to 4.66 mg/L for chloramphenicol. Amoxicillin was the antibiotic detected with the highest concentration at 8.76 mg/L in Table 2 HPLC flow program for analgesics analysis. Step Step type Step LODlimit of detection; LOQlimit of quantitation; SPEsolid phase extraction; all analytes with the same Roman numeral were detected and quantified with the same HPLC method hospital effluents. The concentration of ciprofloxacin was 2.67 mg/L and 2.13 mg/L for doxycycline. The lowest antibiotic concentration recorded was 1.02 mg/L for chloramphenicol (Table 5).
Occurrence of analgesics in liquid samples
Although caffeine is not an analgesic, it is a common adjuvant in various analgesic formulations. Therefore, caffeine was one of the pharmaceutical residues analyzed. All analgesics were detected in both sachets drinking water and municipal waterworks samples. The analgesic detected in the highest concentration was paracetamol which was found in a sampled sachet water at a concentration of 3.20 mg/L ( Table 6). In sachet drinking water, the maximal concentration of both diclofenac and ibuprofen was 0.50 mg/L. The analgesic with the highest detection frequency (67.00%) was diclofenac, with concentrations ranging from 0.10 to 0.50 mg/L. The concentration of ibuprofen in sachet water samples ranged from 0.30 to 0.50 mg/L at a detection frequency of 33.00%. Paracetamol and caffeine were the least frequently detected analytes (17.00%) in sachet water samples, with maximum concentrations of 3.20 and 0.20 mg/L, respectively. All target analgesic analytes were detected in samples from the municipal waterworks (Table 6). Diclofenac and ibuprofen were detected in concentrations ranging from 0.20 mg/L to 0.40 mg/L and, 0.10 mg/L to 1.70 mg/L respectively. The maximum concentration of caffeine was 0.2 mg/L, whereas that of paracetamol was 1.10 mg/L ( Table 6). The results for the occurrence of analgesics in leachate samples are shown in Table 6. Ibuprofen, diclofenac, and caffeine were detected at maximal concentrations of 0.20 mg/L, 1.20 mg/L, and 0.20 mg/L, respectively, as shown in Table 6. In hospital effluents, ibuprofen and diclofenac were present in all samples analyzed with maximal concentrations of 0.20.
Occurrence of antibiotics and analgesics in soil matrices
Amoxicillin was the only antibiotic detected in dumpsite soil samples at a 0.01 mg/kg concentration Table 5. The maximal concentrations of caffeine in both dumpsites soil and municipal waterworks samples were 2.70 mg/kg and 3.00 mg/kg, respectively. Diclofenac was detected with a maximal concentration of 0.90 mg/kg in dumpsite soil and 0.60 mg/ kg in municipal waterworks sediment. The concentration of ibuprofen was 1.50 mg/kg in dumpsite soil and 0.60 mg/kg in municipal waterworks soil. The paracetamol concentration was 2.10 mg/kg in dumpsite soil, as shown in Table 6. Table 7 shows a correlational analysis between basic physicochemical parameters and concentrations of antibiotics and analgesics detected. TDS and EC showed a strong positive correlation (1.00). There was a positive correlation of 0.980 between ciprofloxacin and amoxicillin, doxycycline and chloramphenicol 0.638, chloramphenicol and caffeine 0.492, diclofenac and paracetamol 0.704, diclofenac and caffeine 0.497, caffeine and paracetamol 0.655, and caffeine and ibuprofen 0.608. There was a positive correlation between caffeine and all other analgesics monitored.
Risk assessment
The risk quotient (RQ) is used to predict the effect of pharmaceuticals on the lives of some organisms. In this study, ecological risk of the studied antibiotics and analgesic were calculated as the ratio between the pharmaceutical's maximal environmental concentration, MEC (as obtained from the study) and its predicted no-effect concentration, PNEC (obtained from literature) to assess the possible danger caused by each studied pharmaceutical to environmental species. The risk quotient was estimated on algae (Desmodesmus subspicatus), daphnid (Daphnia magna), crustaceans, and fish (Oncorhynchus mykiss). The lowest ecological PNEC values available in the literature or estimated from the ecological structure activity relationships (ECOSAR) model were assumed for this risk analysis .
The results from the ecological risk assessment are presented in Tables 8 and 9 for antibiotics and analgesics, respectively. RQs for each antibiotic is shown in Table 8. The RQ for ciprofloxacin was 777.0492 and 40.9836 for exposure to algae in hospital effluents and leachates, respectively, indicating a high toxicity risk. Doxycycline and amoxicillin also posed high risks to fishes with RQ values of 3.5040 and 1.1720, respectively. The RQs for the antibiotics studied ranged from 0.0002 to 0.4788 and 0.0001-1.172 for daphnia. and fishes, respectively. The RQ values measured for analgesics in this study were within medium to high-risk ranges, as depicted in Table 9. The maximum RQ was observed at 170 for the ecological risk of ibuprofen on crustaceans. Most of the RQs were greater than or equal to 0.10 indicating medium risk, and RQs greater than or equal to one indicated high risk. Ibuprofen posed a high risk to fishes in all samples studied.
Discussion
pH is one of the most significant water and soil quality parameters. pH values reported from this study were all slightly acidic to slightly basic. Under acidic conditions, analgesic and antibiotics residues can exist as cations, anions, and/or zwitterions, and this can affect their adsorption on soil surfaces as adsorption is pH-dependent . Pharmaceuticals, in their various ionic states, can also interact with surface organic matter. As a result, antibiotics and analgesic residues would remain in the top layer of the soil, making them more susceptible to erosion during downpours . The pH values recorded in this study are also optimum for plant growth and uptake of nutrients and suggest that plant roots may absorb some of these pharmaceuticals and store them in plant tissues . The contaminants could then re-enter the food chain cycle. High conductivity values infer the presence of soluble salts in the soil. Ions that coexist significantly affect the adsorption of antibiotics and analgesics. Ionic strength (IS) can increase or prevent the adsorption of antibiotics and analgesics by inorganic minerals. Monovalent metallic ions such as Na + and K + can compete for adsorption sites with cationic/ zero-valence antibiotics (such as sulfathiazole) and analgesics (such iron/persulfate (Fe/Ps)) which extremely impact the adsorption of these pharmaceuticals. Multivalence metal ions like Ca 2+ , Mg 2+ , Cu 2+ , Al 3+ , and Fe 3+ can also influence the adsorption behaviors of antibiotics. These ions can compete with cationic/zero-valence antibiotics for adsorption sites with low pH. Thus they impede adsorption . As the concentration of metal ions (Ca 2+ , Mg 2+ ) in solution increases, there will be competitive sorption between the antibiotics and metal cations, resulting in a decrease of antibiotic sorption . Competition between ions and PPCPs for sorption sites shows that with the increase of IS, cations (e.g., Ca 2+ ) would be electrostatically bonded to the surface of sediments, and inorganic exchangeable cations will replace the hydrogen ions of acidic groups, thereby reducing the number of initial sorption sites . From the study, high EC values were recorded, which means more soluble salts were in the solution. This could result in low levels of antibiotics and analgesics being detected in the various matrices. TDS measured for dumpsites and hospital effluents were very high, with readings up to 1323.00 and 1121.00 mg/L, respectively. This means that these water samples had vast organic, inorganic, or ionic contaminants in them. Relatively low TDS values were recorded for the water samples from the Sunyani municipal waterworks station and sachet water samples, indicating the absence of a lot of dissolved substances. Numerous therapeutic groups are found in hospital effluents, including antibiotics . The mean concentrations of antibiotics in hospital effluents are presented in Table 5. The concentrations of ciprofloxacin ranged from 0.59 mg/L to 4.74 mg/L in this present study which was higher than the concentrations reported by Azanu and coworkers in hospital effluents in Kumasi (0.01 mg/L to 0.02 mg/L) . The high levels of antibiotics detected in hospital effluents could result from prescription patterns and consumption of antibiotics in the various hospitals sampled. It has been reported that antibiotic prescription in the Sunyani Municipality is one of the highest in Ghana . The high levels of ciprofloxacin reported could be due to the national recommendation of ciprofloxacin for treating urinary tract infection in Ghana, thus, its high rate of usage in hospitals . The high levels of antibiotics could also reflect the disposal patterns of some pharmaceuticals. Most patients excrete antibiotics in their unmetabolized form in urine and feces, and remnants of these wastes could get into hospital effluents .The maximal concentration of ciprofloxacin reported in hospital effluents is over 47,000 times higher than the 0. 0001 mg/L reported aiding the development of antimicrobial resistance . The presence of antibiotics in hospital effluents in this study, and those reported elsewhere, could affect the development of resistance in the microbial communities and show that concerns of antimicrobial resistance are a local problem and a worldwide problem. The presence of antibiotics in hospital effluents could also have deleterious effects on humans because runoffs from hospital effluents can enter surface water during a downpour, and these surface waters are used for domestic purposes in many developing countries like Ghana . The consumption of food or water polluted by runoffs or leakages from some of these hospital effluents investigated could expose people to sub-MIC concentrations, leading to antibiotic resistance development .
The maximum concentrations of analgesics in hospital effluents in this study were 0.30 mg/L, 0.20 mg/L, and 1.10 mg/L for ibuprofen, diclofenac, and paracetamol, respectively. Thomas et al. (2007) reported concentrations of paracetamol in the effluents of hospitals from Oslo (Norway) as 43.00 µg/L, while ibuprofen and diclofenac were 0.90 µg/L and 0.80 µg/L respectively . Another study by Santos et al. (2013) reported acetaminophen and ibuprofen as part of the analgesics/ anti-inflammatories pharmaceuticals detected in high concentrations in all hospital effluents up to 0.06 mg/L and 0.04 mg/L, respectively . Analgesics are routinely used in combination with other classes of pharmaceuticals, which could be a reason for their ubiquity in the sampled hospital effluents. Just as in the case of antibiotics, the presence of these analgesics could also reflect their disposal pattern.
The high concentrations of antibiotics recorded in leachate samples could have serious consequences on the environment. Bengtsson-Palme and Larsson (2016) suggested that environmental concentrations beyond 64.00 µg/L (0.064 mg/L) posed a significant risk for resistance selection for most antibiotics . The concentrations of antibiotics detected in this work are way higher than the limit concentration for . In comparison, results from this study are higher than those from other studies. Many landfills are constructed to limit runoffs into various surface water bodies. A major concern is the absence of engineering liners and collection systems for most landfills in Ghana and other developing countries. The pollution by landfill leachates and their impact on surface and groundwater could thus be severe. This raises a concern and poses a potential risk to the environment and aquatic organisms. Studies have reported that antibiotic and analgesic residues can be found in drinking water as a result of runoffs from industrial sewage, hospitals effluents, and leachates which end up in water bodies at concentrations ranging from ng to µg/L . In this study, none of the antibiotics of interest was detected in the sachet water and municipal waterworks samples from the Sunyani municipality. All the analgesics analyzed were detected in the water matrices (sachet water samples and samples from the Sunyani municipal waterworks station) with a maximum concentration of 3.20 mg/L for paracetamol and diclofenac having the highest frequency of detection of 67.00%. Diclofenac concentrations of 0.20 µg/L and 0.50 µg/L have been reported in South Korea and Spain rivers, respectively . Diclofenac concentration in the river water of Karachi in Pakistan was reported to be 0.40 µg/L . The reports from other works compared to this study show the prevalence of diclofenac in the environment, and the Sunyani municipality is no exception. However, these analgesics in the Sunyani Municipality in Ghana are in alarming concentrations, capable of posing health and ecological risks. From Table 7, there was a very strong significant correlation between TDS and EC at a 99% confidence interval. This means more dissolved solids were present, which contributed to the high conductivity. Again, there is a strong correlation between the pain killers, paracetamol, diclofenac, and caffeine, which suggests these pain killers are administered together. Caffeine is correlated with other analgesics because it has been added to a large number of analgesics for years which showed an enhanced analgesic effect when combined . There was a strong correlation between chloramphenicol and doxycycline (0.638). Also, amoxicillin and ciprofloxacin showed a very strong correlation (0.980). The correlations between the antibiotics could be because they may be complementary drugs or provide an improved therapy when used together.
Maximal environmental concentrations (MEC) of antibiotics in hospital effluents and leachates collected from the Sunyani municipality were used to calculate the risk quotient (RQ). PNEC values and RQs for each antibiotic are shown in Table 8. The RQ for ciprofloxacin was 777.05 and 40.98 for exposure to algae in hospital effluents and leachates, respectively, indicating a high toxicity risk. Doxycycline and amoxicillin also posed a high risk to fishes with RQ values of 3.50 and 1.17, respectively. The RQs for the antibiotics studied ranged from 2.00 × 10 − 4 to 0.48 and 1.00 × 10 − 4 to 1.17 for daphnia and fishes, respectively. Largely, the antibiotics posed medium to no risk to daphnia and fishes, indicating a low risk of toxicity. Comparatively, a study that focused on the occurrence of pharmaceuticals in water from Pego-Oliva Marsh, Spain, computed RQ for ciprofloxacin to be 6.90 for algae . In the Azanu study in Kumasi, Ghana, the RQ for ciprofloxacin was found to be 0.13, which could pose a medium risk to algae in the aquatic environment . This indicates that the presence of ciprofloxacin at high concentrations in the environment is of great concern. This is because it poses a risk to organisms in the aquatic environment, especially to algae which are vital in the ecosystem and may lead to the destruction of the food chain. Ciprofloxacin inhibits or kills algae's cell growth, which may lead to their death and hence affect the ecosystem .
Risks towards some of the targeted aquatic organisms (algae, fishes, and crustaceans) for analgesics were also assessed in both water and soil matrices within the Sunyani Municipality. Averagely, the RQ values measured in the study area were within medium to high-risk ranges as represented in Table 9, with a maximum RQ of 170.00. Most of the RQs were greater than or equal to 0.10 indicating medium risk, and RQs greater than or equal to one indicating a high risk. Ibuprofen poses a high risk to fishes with an RQ > 1, which can impact fish reproduction by male fish feminization. Male fish feminization can reduce fish population and, hence, an economic impact. Studies have shown that RQ > 1 for diclofenac can lead to endocrine disruption by acting on the prostaglandin pathway in rodents and human cells due to hindrances in prostaglandin synthesis .
Conclusion
The occurrence of five antibiotics and four analgesics in the Sunyani municipality was analyzed in both soil and water samples. The high concentrations of antibiotics and analgesics found in almost all samples analyzed indicated considerable pollution of these samples in the Sunyani municipality, Ghana, with antibiotics and analgesics. Ciprofloxacin, doxycycline, diclofenac, and ibuprofen were the most frequently detected antibiotics in all samples. Hence, they could be considered part of the possible dangerous compounds from an environmental risk point of view in Ghana. It was observed that all analgesics could be found in both soil and water matrices in varying concentrations. Risk quotients computed for both antibiotics and analgesics in the various environmental compartments for algae, crustaceans, and fish were in most instances low and medium risk, with few cases of high risk. Based on the risk assessment calculated, ciprofloxacin posed a high risk to aquatic organisms. The antibiotic concentrations found in hospital effluents and leachates samples in this study pose a high risk to antibiotic resistance development in the environment. The high concentrations of antibiotics and analgesics recorded in this study implies that the presence of antibiotics and analgesics in the Sunyani municipality can pose a great ecological risk to organisms and possibly other members of their ecosystem with time. The high concentrations of pharmaceuticals in the environment can be reduced by adopting proper disposal methods for pharmaceuticals. Regular monitoring of pharmaceutical residues and implementation of remediation protocols are recommended.
Declaration of Competing Interest
The authors declare that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper. |
Receiver operating characteristic curves for a simple stochastic process that carries a static signal.
The detection of a weak signal in the presence of noise is an important problem that is often studied in terms of the receiver operating characteristic (ROC) curve, in which the probability of correct detection is plotted against the probability for a false positive. This kind of analysis is typically applied to the situation in which signal and noise are stochastic variables; the detection problem emerges, however, also often in a context in which both signal and noise are stochastic processes and the (correct or false) detection is said to take place when the process crosses a threshold in a given time window. Here we consider the problem for a combination of a static signal which has to be detected against a dynamic noise process, the well-known Ornstein-Uhlenbeck process. We give exact (but difficult to evaluate) quadrature expressions for the detection rates for false positives and correct detections, investigate systematically a simple sampling approximation suggested earlier, compare to an approximation by Stratonovich for the limit of high threshold, and briefly explore the case of multiplicative signal; all theoretical results are compared to extensive numerical simulations of the corresponding Langevin equation. Our results demonstrate that the sampling approximation provides a reasonable description of the ROC curve for this system, and it clarifies limit cases for the ROC curve. |
import { ethers } from "hardhat";
import { parseUnits } from "ethers/lib/utils";
import { deploy } from "../deploy-utils";
import type { IDeployConfig } from "../../types";
(async () => {
const config: IDeployConfig = {
trustedForwarder: "0x61456BF1715C1415730076BB79ae118E806E74d2",
bicoOwner: "<KEY>",
pauser: "<KEY>",
tokens: [
// USDT
{
tokenAddress: "<KEY>",
minCap: parseUnits("100", 18),
maxCap: parseUnits("58160",18),
depositConfigs: [
{
chainId: 5,
minCap: parseUnits("10", 18),
// Max Cap needs to be less than the maxTransfer Fee on destination chain id to cover for incentive amount
maxCap: parseUnits("50000", 18),
},
{
chainId: 80001,
minCap: parseUnits("10",18),
// Max Cap needs to be less than the maxTransfer Fee on destination chain id to cover for incentive amount
maxCap: parseUnits("50000", 18),
},
{
chainId: 43113,
minCap: parseUnits("10", 18),
// Max Cap needs to be less than the maxTransfer Fee on destination chain id to cover for incentive amount
maxCap: parseUnits("50000", 18),
},
],
equilibriumFee: parseUnits("0.1", 8),
maxFee: parseUnits("2.5", 8),
transferOverhead: 82491,
maxWalletLiquidityCap: parseUnits("10000", 18),
maxLiquidityCap: parseUnits("578829", 18),
svgHelper: await ethers.getContractFactory("BSCUSDT"),
decimals: 18,
rewardTokenAddress: "0x756289346D2b3C867966899c6D0467EdEb4Da3C4",
rewardRatePerSecond: parseUnits("0.003662", 18),
excessStateTransferFeePer: parseUnits("0.045", 8),
},
// BICO
{
tokenAddress: "0x756289346D2b3C867966899c6D0467EdEb4Da3C4",
minCap: parseUnits("50", 18),
maxCap: parseUnits("123220", 18),
depositConfigs: [
{
chainId: 5,
minCap: parseUnits("10", 18),
// Max Cap needs to be less than the maxTransfer Fee on destination chain id to cover for incentive amount
maxCap: parseUnits("100000", 18),
},
{
chainId: 80001,
minCap: parseUnits("10", 18),
// Max Cap needs to be less than the maxTransfer Fee on destination chain id to cover for incentive amount
maxCap: parseUnits("100000", 18),
},
{
chainId: 43113,
minCap: parseUnits("10", 18),
// Max Cap needs to be less than the maxTransfer Fee on destination chain id to cover for incentive amount
maxCap: parseUnits("100000", 18),
},
],
equilibriumFee: ethers.utils.parseUnits("0.1", 8),
maxFee: ethers.utils.parseUnits("2.5", 8),
transferOverhead: 85949,
maxWalletLiquidityCap: parseUnits("8474.57", 18),
maxLiquidityCap: parseUnits("610350", 18),
svgHelper: await ethers.getContractFactory("BSCBICO"),
decimals: 18,
rewardTokenAddress: "0x756289346D2b3C867966899c6D0467EdEb4Da3C4",
rewardRatePerSecond: parseUnits("0", 18),
excessStateTransferFeePer: parseUnits("0.045", 8),
},
],
};
await deploy(config);
})();
|
It turns out Harvey Weinstein’s long history of sexual assault may not have been supported solely by an endemic, institutionalized power structure based in exploitation and abuse that’s as old as showbiz itself. It may have also been literally written into Weinstein’s contract, according to the latest revelation to this story that shows no signs of abating nor even lessening in degrees of awfulness, several days in. Even more dispiriting, this contractual loophole may now give Weinstein legal recourse to sue the company that ousted him over multiple allegations of rape, potentially allowing him to recoup a tidy little severance that he can then use to reflect penitently on his poor life choices on a nice beach somewhere.
TMZ managed to obtain Weinstein’s 2015 employment contract with The Weinstein Company, which contains suspiciously specific language laying out what would—totally hypothetically—happen if Weinstein “treated someone improperly in violation of the company’s Code of Conduct.” According to the clause, “You [Weinstein] will pay the company liquidated damages of $250,000 for the first such instance, $500,000 for the second such instance, $750,000 for the third such instance, and $1,000,000 for each additional instance.” These payments along the escalating penalty ladder to hell would then constitute a “cure,” allowing Weinstein to keep his job so long as he kept reimbursing the company for its troubles. Furthermore, his contract stipulates that Weinstein can’t be fired for anything without both mediation and arbitration, neither of which he received.
In other words, everything about this was set up so that Weinstein could just continue to pull the same shit over and over again, protected by his power and wealth. And if it all went south, he would still get every chance to collect.
In other other words, it now makes sense that, among Weinstein’s first responses to these unfolding allegations—along with hiring criminal lawyers and heroic anti-blogging crusader Charles Harder to punish The New York Times—was to bring in Patricia Glaser to potentially go after his brother and the rest of The Weinstein Company board. Any such lawsuit would probably center on this contract and how his former colleagues violated Weinstein’s rights to go on abusing women, so long as he kept writing them checks. It all promises to be one of the most dispiriting quibbles over “well, technically” language ever heard in a courtroom, and everyone who participates in it should feel a deep, eddying abyss opening in their very souls.
In the meantime, everyone at home can get a little taste of that right now by ruminating on the fact that the very existence of this clause means Weinstein’s fellow board members were well aware of his behavior—even writing it into his goddamn contract. This all follows a New York Times report this week that included a statement from board member Lance Maerov—the one who boasted of instituting a new Weinstein Company code of conduct with specific language about sexual harassment, right on the heels of several complaints about Weinstein. In the October 11 NYT article, Maerov said he’d signed off on Weinstein’s new contract while admitting he’d known about those many settlements that had been paid out over the years, saying he “had assumed they were used to cover up consensual affairs.” Maerov added, “I don’t know what else I could have done.”
Advertisement
At the time, quotes such as these seemed like their own desperate cover-up simply for the board’s feigned “utter surprise” at the allegations against Weinstein when it fired him. But the revelation of contract language that blatantly seems to take Weinstein’s history of sexual assault into account is far more damning, suggesting that the board members not only knew about it, but actually, implicitly condoned it in writing. Not only has The Weinstein Company doomed itself to being completely dismantled by its own cowardice, but it also seems to have opened the door to Weinstein suing for his golden parachute. Hooray for Hollywood. |
<reponame>ralli/gofaker<filename>book.go<gh_stars>1-10
package gofaker
// Book provides functions related to books.
type Book struct {
faker *Faker
}
// Title generates the books title.
func (b *Book) Title() string {
return b.faker.MustParse("book.title")
}
// Author generates the books authors name.
func (b *Book) Author() string {
return b.faker.MustParse("book.author")
}
// Publisher generates the books publishers name.
func (b *Book) Publisher() string {
return b.faker.MustParse("book.publisher")
}
// Genre generates the books genre.
func (b *Book) Genre() string {
return b.faker.MustParse("book.genre")
}
|
def create_docker_image(args):
device = DockerDevice(args.emuzip, args.imgzip, args.dest)
device.create_docker_file(args.extra)
img = device.create_container()
if img and args.start:
device.launch(img) |
def send_log_configuration(
bus: EventBus, logger_config_id: ParticipantId, config: LogConfiguration
) -> None:
set_state(bus, logger_config_id, LogConfiguration, config) |
// ParseResearcherMDFile reads markdown file contents containing YAML and markdown
// and returns Researcher data struct
func ParseResearcherMDFile(reader io.Reader) (researcher Researcher, err error) {
pf, err := pageparser.ParseFrontMatterAndContent(reader)
if err != nil {
return researcher, err
}
fm, err := yaml.Marshal(pf.FrontMatter)
if err != nil {
return researcher, err
}
err = yaml.Unmarshal(fm, &researcher)
if err != nil {
return researcher, err
}
researcher.Bio = string(pf.Content)
return
} |
<filename>lib/aws-sdk-sync.ts
import AWS from "aws-sdk";
import { spawnSync } from "child_process";
// Build a function to call on a different process
// use `module.require` to keep webpack from overriding the function.
// This isn't run within the bundle
// It is stringified and run in a different process
export function invoke(service: string, method: string, config: any, params: any) {
let AWS = module.require.call(module, "aws-sdk");
let hasLogged = false;
try {
new AWS[service](config)[method](params, (err: any, data: any) => {
if (!hasLogged) {
hasLogged = true;
console.log(`RESPONSE::${JSON.stringify({ error: err, response: data })}::RESPONSE`);
}
});
} catch (err: any) {
if (err.message.match(/is not a function/)) {
err.message = `AWS.${service}.${method} is not a function`;
} else if (err.message.match(/is not a constructor/)) {
err.message = `AWS.${service} is not a constructor`;
}
if (!hasLogged) {
hasLogged = true;
console.log(`RESPONSE::${JSON.stringify({ error: { message: err.message } })}::RESPONSE`);
}
}
}
function run(service: string, method: string, config: any, params: any) {
let fn = `(${invoke.toString()})("${service}", "${method}", ${JSON.stringify(config)}, ${JSON.stringify(params)})`;
// Spawn node with the function to run `node -e (()=>{})`
// Using `RESPONSE::{}::RESPONSE` to denote the response in the output
let child = spawnSync(process.execPath, ["-e", fn]);
if (child.error != null) {
// If the process had an error, throw it
throw child.error;
} else if (child.output.length > 0) {
// Try to extract the response
let output = child.output.join("");
let outputJson = (child.output.join("").match(/RESPONSE::({.*})::RESPONSE/) || [])[1];
if (outputJson == null) {
throw new Error(`Invalid Response: ${output}`);
} else {
let parsedData = JSON.parse(outputJson);
// Return the response or error
if (parsedData.error != null) {
throw Object.assign(new Error(parsedData.error.message), parsedData.error);
} else {
return parsedData.response;
}
}
}
}
class Service<T> {
constructor(private options?: T) { }
protected invoke(method: string, params?: any): any {
return run(this.constructor.name, method, this.options, params);
}
}
export class SecretsManager extends Service<AWS.SecretsManager.ClientConfiguration> {
getSecretValue(params: AWS.SecretsManager.GetSecretValueRequest): AWS.SecretsManager.GetSecretValueResponse {
return this.invoke("getSecretValue", params);
}
}
export class S3 extends Service<AWS.S3.ClientConfiguration> {
listBuckets(): AWS.S3.ListBucketsOutput {
return this.invoke("listBuckets");
}
}
export default {
SecretsManager,
S3
};
|
def refactor(module, name, repl):
environ().refactor(module, name, repl) |
<reponame>stungkit/editor
import type { Middleware, Store } from 'redux';
import createStore from './store';
import type { Value } from './types/node';
import type { RootState } from './types/state';
import { setLang } from './actions/setting';
import { findNodeInState } from './selector/editable';
import { createContext } from 'react';
import { createId } from './utils/createId';
import { CURRENT_EDITABLE_VERSION } from './migrations/EDITABLE_MIGRATIONS';
export const EditorContext = createContext<EditorStore | null>(null);
export type Languages = Array<{
lang: string;
label: string;
}>;
export interface CoreEditorProps<T extends RootState = RootState> {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
middleware?: Middleware[];
store?: Store<T> | null;
initialState: RootState;
}
class EditorStore<T extends RootState = RootState> {
store: Store<RootState>;
middleware: Middleware[];
constructor({ middleware = [], store, initialState }: CoreEditorProps<T>) {
this.store = store || createStore(initialState, middleware);
this.middleware = middleware;
}
public setLang(lang: string) {
this.store.dispatch(setLang(lang));
}
public getNodeWithAncestors = (nodeId: string) => {
return findNodeInState(this.store.getState(), nodeId);
};
public getNode = (nodeId: string) => {
return findNodeInState(this.store.getState(), nodeId)?.node;
};
}
export const createEmptyState: () => Value = () =>
({ id: createId(), rows: [], version: CURRENT_EDITABLE_VERSION } as Value);
export default EditorStore;
|
// MultiRuns returns a DoAndReturn func that puts the given test runs in the dst interface
// for a shared.Datastore.GetMulti call.
func MultiRuns(runs shared.TestRuns) func(keys []shared.Key, dst interface{}) error {
return func(keys []shared.Key, dst interface{}) error {
out, ok := dst.(shared.TestRuns)
if !ok || len(out) != len(keys) || len(runs) != len(out) {
return errors.New("invalid destination array")
}
for i := range runs {
out[i] = runs[i]
}
return nil
}
} |
def error_missing_library(record):
if os.name == 'nt':
pass
else:
if 'error while loading shared libraries' in record:
missing_library = ''
record_bits = record.split(':')
for token in record_bits:
if token[:3] == 'lib':
missing_library = token
break
if missing_library:
raise RuntimeError('child missing library %s' % \
missing_library)
else:
raise RuntimeError('child missing library (%s)' % \
record.strip()) |
/**
* Executes the given MDX and packs the results into an array
*/
public class OlapQueryExecution implements ProcedureExecution {
protected Command command;
protected OlapConnection connection;
protected ExecutionContext context;
protected OlapExecutionFactory executionFactory;
private OlapStatement stmt;
private CellSet cellSet;
private CellSetAxis columnsAxis;
private int colWidth;
private ListIterator<Position> rowPositionIterator;
private String mdxQuery;
private boolean returnsArray;
public OlapQueryExecution(List<Argument> arguments, Command command, OlapConnection connection, ExecutionContext context, OlapExecutionFactory executionFactory, String mdxQuery, boolean returnsArray) {
this.mdxQuery = mdxQuery;
if (arguments.size() > 0 || !returnsArray) { //TODO this is a hack at backwards compatibility
StringBuilder buffer = new StringBuilder();
SQLStringVisitor.parseNativeQueryParts(mdxQuery, arguments, buffer, new SQLStringVisitor.Substitutor() {
@Override
public void substitute(Argument arg, StringBuilder builder, int index) {
Literal argumentValue = arg.getArgumentValue();
Object value = argumentValue.getValue();
if (value == null || value instanceof Number || value instanceof Boolean || value instanceof String) {
builder.append(argumentValue);
} else if (value instanceof Date) {
//bind as a string literal
builder.append(new Literal(value.toString(), String.class));
} else {
//bind as a string literal using the teiid format - this is likely not what the user wants
builder.append(new Literal(argumentValue.toString(), String.class));
}
}
});
this.mdxQuery = buffer.toString();
}
this.command = command;
this.connection = connection;
this.context = context;
this.executionFactory = executionFactory;
this.returnsArray = returnsArray;
}
@Override
public void execute() throws TranslatorException {
try {
stmt = this.connection.createStatement();
cellSet = stmt.executeOlapQuery(mdxQuery);
CellSetAxis rowAxis = this.cellSet.getAxes().get(Axis.ROWS.axisOrdinal());
rowPositionIterator = rowAxis.iterator();
columnsAxis = cellSet.getAxes().get(Axis.COLUMNS.axisOrdinal());
colWidth = rowAxis.getAxisMetaData().getHierarchies().size() + this.columnsAxis.getPositions().size();
} catch (SQLException e) {
throw new TranslatorException(e);
}
}
@Override
public void cancel() throws TranslatorException {
try {
OlapStatement olapStatement = this.stmt;
if (olapStatement != null) {
olapStatement.cancel();
}
} catch (SQLException e) {
throw new TranslatorException(e);
}
}
@Override
public void close() {
try {
if (this.stmt != null) {
this.stmt.close();
this.stmt = null;
}
} catch (SQLException e) {
LogManager.logDetail(LogConstants.CTX_CONNECTOR, e, "Exception closing"); //$NON-NLS-1$
}
}
@Override
public List<?> next() throws TranslatorException {
if (!rowPositionIterator.hasNext()) {
return null;
}
Position rowPosition = rowPositionIterator.next();
Object[] result = new Object[colWidth];
int i = 0;
// add in rows axis
List<Member> members = rowPosition.getMembers();
for (Member member:members) {
String columnName = member.getName();
result[i++] = columnName;
}
// add col axis
for (Position colPos : columnsAxis) {
Cell cell = cellSet.getCell(colPos, rowPosition);
result[i++] = cell.getValue();
}
if (returnsArray) {
ArrayList<Object[]> results = new ArrayList<Object[]>(1);
results.add(result);
return results;
}
return Arrays.asList(result);
}
@Override
public List<?> getOutputParameterValues() throws TranslatorException {
return null;
}
} |
//DISPLAY 15.7 Implementation for the Derived Class SalariedEmployee
//This is the file salariedemployee.cpp.
//This is the implementation for the class SalariedEmployee.
//The interface for the class SalariedEmployee is in
//the header file salariedemployee.h.
#include <iostream>
#include <string>
#include "salariedemployee.h"
using namespace std;
namespace employeessavitch
{
SalariedEmployee::SalariedEmployee( ) : Employee( ), salary(0)
{
//deliberately empty
}
SalariedEmployee::SalariedEmployee(string the_name, string the_number,
double the_weekly_salary)
: Employee(the_name, the_number), salary(the_weekly_salary)
{
//deliberately empty
}
double SalariedEmployee::get_salary( ) const
{
return salary;
}
void SalariedEmployee::set_salary(double new_salary)
{
salary = new_salary;
}
void SalariedEmployee::print_check( )
{
set_net_pay(salary);
cout << "\n__________________________________________________\n";
cout << "Pay to the order of " << get_name( ) << endl;
cout << "The sum of " << get_net_pay( ) << " Dollars\n";
cout << "_________________________________________________\n";
cout << "Check Stub NOT NEGOTIABLE \n";
void SalariedEmployee::print_check( )
{
set_net_pay(salary);
cout << "\n__________________________________________________\n";
cout << "Pay to the order of " << get_name( ) << endl;
cout << "The sum of " << get_net_pay( ) << " Dollars\n";
cout << "_________________________________________________\n";
cout << "Check Stub NOT NEGOTIABLE \n";
cout << "Employee Number: " << get_ssn( ) << endl;
cout << "Salaried Employee. Regular Pay: "
<< salary << endl;
cout << "_________________________________________________\n";
}
}//employeessavitch
|
async def topic_set_roles(self, ctx: MyContext):
topics_repr: list[str] = []
none_emoji: str = self.bot.get_cog('Emojis').customs['nothing']
topics = await self.db_get_topics(ctx.guild.id)
topics.append(await self.db_get_defaults(ctx.guild.id))
for topic in topics:
name = topic['topic'] or await self.bot._(ctx.guild.id, "tickets.other")
if topic['topic_emoji']:
emoji = discord.PartialEmoji.from_str(topic['topic_emoji'])
topics_repr.append(f"{emoji} {name}")
else:
topics_repr.append(f"{none_emoji} {name}")
if topic['role']:
topics_repr[-1] += f" - <@&{topic['role']}>"
title = await ctx.bot._(ctx.guild.id, "tickets.topic.list")
if ctx.can_send_embed:
embed = discord.Embed(title=title, description="\n".join(topics_repr), color=discord.Color.blue())
await ctx.send(embed=embed)
else:
await ctx.send(f"**{title}**\n\n" + "\n".join(topics_repr)) |
n,v=[int(i) for i in input().split()]
d={}
for i in range(n):
a,b=[int(i) for i in input().split()]
if a in d:
d[a]+=b
else:
d[a]=b
set_tree=sorted(d)
set_tree=list(range(1,max(set_tree)+2))
set_tree.append(0)
d[0]=0
S=0
for i in set_tree:
if i in d:
None
else:
d[i]=0
for i in set_tree[:-1]:
if d[i]<=v:
S+=d[i]
elif d[i]>=2*v:
S+=v
d[i+1]=d[i+1]+v
else:
S+=v
d[i+1]+=d[i]-v
print(S)
#if d[set_tree[i]]<=2*v:
#if d[0]<=v:S+=d[0]else: S+=v
#set_tree=sorted(d)
|
Bangladesh became a tighter unit after they were pushed into a corner due to injury problems, according to their coach Shane Jurgensen
Mominul Haque doesn't like the spotlight much, but has an appetite for big scores
Bangladesh's captain Mushfiqur Rahim has called upon his senior players to make use of a rare opportunity to succeed against a higher-ranked side in Test cricket, ahead of the second Test in Colombo
Mushfiqur's love affair with Galle, Mendis eclipses an old record, century stands, and other statstical highlights from the third day of the first Test
Backing Kusal Mendis was an easy decision for Sri Lanka coach Graham Ford and the batsman repaid the faith hitting 194 in Galle
ABOUT COOKIES
To help make this website better, to improve and personalize your experience and for advertising purposes, are you happy to accept cookies and other technologies? |
// Gets a session. Returns `NOT_FOUND` if the session does not exist. This is mainly useful for determining whether a session is still alive.
func LookupSession(ctx *pulumi.Context, args *LookupSessionArgs, opts ...pulumi.InvokeOption) (*LookupSessionResult, error) {
var rv LookupSessionResult
err := ctx.Invoke("google-native:spanner/v1:getSession", args, &rv, opts...)
if err != nil {
return nil, err
}
return &rv, nil
} |
def testing_merge_mpi_files(filepath_wildcard, mpiout_filename, outputfilepath):
check_param_type("filepath_wildcard", filepath_wildcard, str)
check_param_type("mpiout_filename", mpiout_filename, str)
check_param_type("outputfilepath", outputfilepath, str)
cmd = "rm -rf {0}".format(outputfilepath)
os.system(cmd)
mpipath = "{0}/1".format(mpiout_filename)
if os.path.isdir(mpipath):
dirItemList = os.listdir(mpipath)
for rankdir in dirItemList:
mpirankoutdir = "{0}/{1}".format(mpipath, rankdir)
mpioutfile = "{0}/{1}".format(mpirankoutdir, "stdout")
if os.path.isdir(mpirankoutdir) and os.path.isfile(mpioutfile):
cmd = "cat {0} >> {1}".format(mpioutfile, outputfilepath)
os.system(cmd)
else:
cmd = "cat {0} > {1}".format(filepath_wildcard, outputfilepath)
os.system(cmd) |
Vapor Phase Terpenes Mitigate Oxidative Degradation of Cannabis sativa Inflorescence Cannabinoid Content in an Accelerated Stability Study.
Introduction: As Cannabis sativa L. (Cannabaceae) ages, inflorescence phytochemicals are susceptible to oxidative degradation. Reduction of Δ9-tetrahydrocannabinol (Δ9-THC) content has the potential to impact the reliability and accuracy of dosing. Advances that improve cannabinoid stability during storage would have an important impact in medical cannabis markets. Reported here is the use of C. sativa terpenes with antioxidant properties that improve inflorescence cannabinoid stability. Materials and Methods: Killer Kush inflorescence samples were stored in a temperature-controlled environment, in opaque jars. To accelerate the rate of oxidate degradation, samples were stored with the oxidizing agent hydrogen peroxide. Vapor phase terpenes were added to inflorescence packaging. Two terpene blends and three different dosage amounts were evaluated. Inflorescence stability samples were prepared in triplicate for each sample type. Cannabinoid content was quantitatively assessed after 24, 81, and 127 days of storage using high-performance liquid chromatography. Terpene content was assessed using headspace gas chromatography mass spectrometry. Results from inflorescence stored with and without external terpenes were compared by analysis of variance (ANOVA) data processing. Results: After 127 days of storage, inflorescence in the accelerated study experienced a loss of 18.0% and 34.3% total Δ9-THC content for samples stored with and without external terpenes, respectively. The differences in cannabinoid content were found to be statistically significant at all timepoints using ANOVA processing. In the nonaccelerated study, only one of the six sample types investigated had a statistically significant greater total Δ9-THC content than control at all timepoints. Nevertheless, a dose-dependent relationship between the amount of external terpenes added to inflorescence and the preservation of total Δ9-THC content was observed. Discussion: In the accelerated study, exogenous terpenes reduced the degradation of inflorescence cannabinoid content by 47.4%. This represents the first reported addition of terpene antioxidants to inflorescence packaging for cannabinoid preservation. Of note, the antioxidants used in this system can be obtained from C. sativa. This is advantageous from a toxicological perspective as inhaling synthetic antioxidants presents unknown and unpredictable risks. When fully developed, the novel system has applications for inflorescence packaged for individual sale, as well as long-term storage of bulk biomass. |
<reponame>hardwayit/emblocks
#ifndef EMBLOCKS_LUN_H
#define EMBLOCKS_LUN_H
struct LUNMap
{
unsigned int base;
unsigned int sectors;
};
struct LUNDesc
{
unsigned char name[16];
};
bool lun_init(unsigned char data_nvmblk, unsigned char table_nvmblk, unsigned int table_offset);
unsigned char lun_max_count(void);
unsigned char lun_count(void);
bool lun_ready(unsigned char lun);
unsigned char lun_state(unsigned char lun);
unsigned int lun_sectors(unsigned char lun);
struct LUNMap* lun_map(void);
bool lun_map_flush(void);
bool lun_push_table(void);
bool lun_pop_table(void);
bool lun_read(unsigned char lun, unsigned int sector, void* data, unsigned int count);
bool lun_write(unsigned char lun, unsigned int sector, const void* data, unsigned int count);
#endif
|
use std::collections::HashMap;
use crate::expr::{EvalError, EvalErrorMessage, Expr, ExprValue, Location};
use crate::value::Primitive;
type R = Result<Expr, EvalError>;
type F = fn(Location, Vec<Expr>) -> R;
#[derive(Debug)]
pub struct Functions(HashMap<String, F>);
impl Functions {
pub fn new() -> Self {
Self(HashMap::new())
}
pub fn default() -> Self {
let mut result = Self::new();
result.insert("not", f_not);
result.insert("and", f_and);
result.insert("or", f_or);
result.insert("add", f_add);
result.insert("mul", f_mul);
result.insert("fract", f_fract);
result
}
pub fn insert(&mut self, key: &str, value: F) {
self.0.insert(key.to_string(), value);
}
pub fn get(&self, key: &str) -> Option<&F> {
self.0.get(key)
}
}
macro_rules! check_argc_exact {
($c:expr; $location:expr, $args:expr) => {
if $args.len() != $c {
return Err(EvalError {
location: $location,
message: EvalErrorMessage::ArgumentCount,
});
}
};
}
macro_rules! check_argc_min {
($minc:expr; $location:expr, $args:expr) => {
if $args.len() < $minc {
return Err(EvalError {
location: $location,
message: EvalErrorMessage::ArgumentCount,
});
}
};
}
macro_rules! value {
($arg:expr) => {
if let ExprValue::Primitive(p) = $arg.value.clone() {
p
} else {
unreachable!("Calls and symbols should not exist anymore")
}
};
}
fn f_not(location: Location, args: Vec<Expr>) -> Result<Expr, EvalError> {
check_argc_exact!(1; location, args);
let acc = value!(args[0])
.not()
.map_err(|err| args[0].error_here(err))?;
Ok(Expr {
location,
value: ExprValue::Primitive(acc),
})
}
fn f_and(location: Location, args: Vec<Expr>) -> Result<Expr, EvalError> {
check_argc_min!(1; location, args);
let mut acc = Primitive::Boolean(true);
for arg in args.into_iter() {
acc = acc.and(&value!(arg)).map_err(|err| arg.error_here(err))?;
}
Ok(Expr {
location,
value: ExprValue::Primitive(acc),
})
}
fn f_or(location: Location, args: Vec<Expr>) -> Result<Expr, EvalError> {
check_argc_min!(1; location, args);
let mut acc = Primitive::Boolean(false);
for arg in args.into_iter() {
acc = acc.or(&value!(arg)).map_err(|err| arg.error_here(err))?;
}
Ok(Expr {
location,
value: ExprValue::Primitive(acc),
})
}
fn f_add(location: Location, args: Vec<Expr>) -> Result<Expr, EvalError> {
check_argc_min!(2; location, args);
let mut acc = value!(args[0]);
for arg in args.into_iter().skip(1) {
acc = acc.add(&value!(arg)).map_err(|message| EvalError {
location: arg.location,
message,
})?;
}
Ok(Expr {
location,
value: ExprValue::Primitive(acc),
})
}
fn f_mul(location: Location, args: Vec<Expr>) -> Result<Expr, EvalError> {
check_argc_min!(2; location, args);
let mut acc = value!(args[0]);
for arg in args.into_iter().skip(1) {
acc = acc.mul(&value!(arg)).map_err(|message| EvalError {
location: arg.location,
message,
})?;
}
Ok(Expr {
location,
value: ExprValue::Primitive(acc),
})
}
fn f_fract(location: Location, args: Vec<Expr>) -> Result<Expr, EvalError> {
check_argc_exact!(1; location, args);
if let Primitive::Float(p) = value!(args[0]) {
Ok(Expr {
location,
value: ExprValue::Primitive(Primitive::Float(p.fract())),
})
} else {
Err(args[0].error_here(EvalErrorMessage::InvalidArgument(
"Only floats have fractional parts".to_owned(),
)))
}
}
|
def partition(A, p, r):
(suite, x) = A[r]
i = p - 1
for j in range(p, r):
if A[j][1] <= x:
i = i + 1
A[i], A[j] = A[j], A[i]
A[i+1], A[r] = A[r], A[i+1]
return i + 1
def quick_sort(A, p, r):
if p < r:
q = partition(A, p, r)
quick_sort(A, p, q - 1)
quick_sort(A, q + 1, r)
if __name__ == "__main__":
import sys
n = sys.stdin.readline()
items = []
suite_order = {}
for line in sys.stdin:
item = line.strip().split()
items.append(item)
if item[1] not in suite_order:
suite_order[item[1]] = []
suite_order[item[1]].append(item[0])
items = [ (item[0], int(item[1])) for item in items ]
quick_sort(items, 0, len(items) - 1)
is_stable = True
for item in items:
if suite_order[str(item[1])][0] != item[0]:
is_stable = False
suite_order[str(item[1])].pop(0)
if is_stable:
print "Stable"
else:
print "Not stable"
for item in items:
print "%s %s" % (item[0], str(item[1])) |
//------------------------------------------------------------------------------
// isRMWRegOper: Can this binary tree node be used in a Read-Modify-Write format
//
// Arguments:
// tree - a binary tree node
//
// Return Value:
// Returns true if we can use the read-modify-write instruction form
//
// Notes:
// This is used to determine whether to preference the source to the destination register.
//
bool Lowering::isRMWRegOper(GenTreePtr tree)
{
assert(tree->OperIsBinary());
if (tree->OperIsCompare() || tree->OperIs(GT_CMP))
{
return false;
}
switch (tree->OperGet())
{
case GT_LEA:
case GT_STOREIND:
case GT_ARR_INDEX:
case GT_STORE_BLK:
case GT_STORE_OBJ:
return false;
case GT_MUL:
return (!IsContainableImmed(tree, tree->gtOp.gtOp2) && !IsContainableImmed(tree, tree->gtOp.gtOp1));
default:
return true;
}
} |
<gh_stars>1-10
import numpy as np
from sklearn.utils.testing import (assert_array_almost_equal,
assert_array_equal, assert_true,
assert_raise_message)
from sklearn.datasets import load_linnerud
from sklearn.cross_decomposition import pls_, CCA
from nose.tools import assert_equal
def test_pls():
d = load_linnerud()
X = d.data
Y = d.target
# 1) Canonical (symmetric) PLS (PLS 2 blocks canonical mode A)
# ===========================================================
# Compare 2 algo.: nipals vs. svd
# ------------------------------
pls_bynipals = pls_.PLSCanonical(n_components=X.shape[1])
pls_bynipals.fit(X, Y)
pls_bysvd = pls_.PLSCanonical(algorithm="svd", n_components=X.shape[1])
pls_bysvd.fit(X, Y)
# check equalities of loading (up to the sign of the second column)
assert_array_almost_equal(
pls_bynipals.x_loadings_,
pls_bysvd.x_loadings_, decimal=5,
err_msg="nipals and svd implementations lead to different x loadings")
assert_array_almost_equal(
pls_bynipals.y_loadings_,
pls_bysvd.y_loadings_, decimal=5,
err_msg="nipals and svd implementations lead to different y loadings")
# Check PLS properties (with n_components=X.shape[1])
# ---------------------------------------------------
plsca = pls_.PLSCanonical(n_components=X.shape[1])
plsca.fit(X, Y)
T = plsca.x_scores_
P = plsca.x_loadings_
Wx = plsca.x_weights_
U = plsca.y_scores_
Q = plsca.y_loadings_
Wy = plsca.y_weights_
def check_ortho(M, err_msg):
K = np.dot(M.T, M)
assert_array_almost_equal(K, np.diag(np.diag(K)), err_msg=err_msg)
# Orthogonality of weights
# ~~~~~~~~~~~~~~~~~~~~~~~~
check_ortho(Wx, "x weights are not orthogonal")
check_ortho(Wy, "y weights are not orthogonal")
# Orthogonality of latent scores
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
check_ortho(T, "x scores are not orthogonal")
check_ortho(U, "y scores are not orthogonal")
# Check X = TP' and Y = UQ' (with (p == q) components)
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# center scale X, Y
Xc, Yc, x_mean, y_mean, x_std, y_std =\
pls_._center_scale_xy(X.copy(), Y.copy(), scale=True)
assert_array_almost_equal(Xc, np.dot(T, P.T), err_msg="X != TP'")
assert_array_almost_equal(Yc, np.dot(U, Q.T), err_msg="Y != UQ'")
# Check that rotations on training data lead to scores
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Xr = plsca.transform(X)
assert_array_almost_equal(Xr, plsca.x_scores_,
err_msg="rotation on X failed")
Xr, Yr = plsca.transform(X, Y)
assert_array_almost_equal(Xr, plsca.x_scores_,
err_msg="rotation on X failed")
assert_array_almost_equal(Yr, plsca.y_scores_,
err_msg="rotation on Y failed")
# "Non regression test" on canonical PLS
# --------------------------------------
# The results were checked against the R-package plspm
pls_ca = pls_.PLSCanonical(n_components=X.shape[1])
pls_ca.fit(X, Y)
x_weights = np.array(
[[-0.61330704, 0.25616119, -0.74715187],
[-0.74697144, 0.11930791, 0.65406368],
[-0.25668686, -0.95924297, -0.11817271]])
# x_weights_sign_flip holds columns of 1 or -1, depending on sign flip
# between R and python
x_weights_sign_flip = pls_ca.x_weights_ / x_weights
x_rotations = np.array(
[[-0.61330704, 0.41591889, -0.62297525],
[-0.74697144, 0.31388326, 0.77368233],
[-0.25668686, -0.89237972, -0.24121788]])
x_rotations_sign_flip = pls_ca.x_rotations_ / x_rotations
y_weights = np.array(
[[+0.58989127, 0.7890047, 0.1717553],
[+0.77134053, -0.61351791, 0.16920272],
[-0.23887670, -0.03267062, 0.97050016]])
y_weights_sign_flip = pls_ca.y_weights_ / y_weights
y_rotations = np.array(
[[+0.58989127, 0.7168115, 0.30665872],
[+0.77134053, -0.70791757, 0.19786539],
[-0.23887670, -0.00343595, 0.94162826]])
y_rotations_sign_flip = pls_ca.y_rotations_ / y_rotations
# x_weights = X.dot(x_rotation)
# Hence R/python sign flip should be the same in x_weight and x_rotation
assert_array_almost_equal(x_rotations_sign_flip, x_weights_sign_flip)
# This test that R / python give the same result up to column
# sign indeterminacy
assert_array_almost_equal(np.abs(x_rotations_sign_flip), 1, 4)
assert_array_almost_equal(np.abs(x_weights_sign_flip), 1, 4)
assert_array_almost_equal(y_rotations_sign_flip, y_weights_sign_flip)
assert_array_almost_equal(np.abs(y_rotations_sign_flip), 1, 4)
assert_array_almost_equal(np.abs(y_weights_sign_flip), 1, 4)
# 2) Regression PLS (PLS2): "Non regression test"
# ===============================================
# The results were checked against the R-packages plspm, misOmics and pls
pls_2 = pls_.PLSRegression(n_components=X.shape[1])
pls_2.fit(X, Y)
x_weights = np.array(
[[-0.61330704, -0.00443647, 0.78983213],
[-0.74697144, -0.32172099, -0.58183269],
[-0.25668686, 0.94682413, -0.19399983]])
x_weights_sign_flip = pls_2.x_weights_ / x_weights
x_loadings = np.array(
[[-0.61470416, -0.24574278, 0.78983213],
[-0.65625755, -0.14396183, -0.58183269],
[-0.51733059, 1.00609417, -0.19399983]])
x_loadings_sign_flip = pls_2.x_loadings_ / x_loadings
y_weights = np.array(
[[+0.32456184, 0.29892183, 0.20316322],
[+0.42439636, 0.61970543, 0.19320542],
[-0.13143144, -0.26348971, -0.17092916]])
y_weights_sign_flip = pls_2.y_weights_ / y_weights
y_loadings = np.array(
[[+0.32456184, 0.29892183, 0.20316322],
[+0.42439636, 0.61970543, 0.19320542],
[-0.13143144, -0.26348971, -0.17092916]])
y_loadings_sign_flip = pls_2.y_loadings_ / y_loadings
# x_loadings[:, i] = Xi.dot(x_weights[:, i]) \forall i
assert_array_almost_equal(x_loadings_sign_flip, x_weights_sign_flip, 4)
assert_array_almost_equal(np.abs(x_loadings_sign_flip), 1, 4)
assert_array_almost_equal(np.abs(x_weights_sign_flip), 1, 4)
assert_array_almost_equal(y_loadings_sign_flip, y_weights_sign_flip, 4)
assert_array_almost_equal(np.abs(y_loadings_sign_flip), 1, 4)
assert_array_almost_equal(np.abs(y_weights_sign_flip), 1, 4)
# 3) Another non-regression test of Canonical PLS on random dataset
# =================================================================
# The results were checked against the R-package plspm
n = 500
p_noise = 10
q_noise = 5
# 2 latents vars:
np.random.seed(11)
l1 = np.random.normal(size=n)
l2 = np.random.normal(size=n)
latents = np.array([l1, l1, l2, l2]).T
X = latents + np.random.normal(size=4 * n).reshape((n, 4))
Y = latents + np.random.normal(size=4 * n).reshape((n, 4))
X = np.concatenate(
(X, np.random.normal(size=p_noise * n).reshape(n, p_noise)), axis=1)
Y = np.concatenate(
(Y, np.random.normal(size=q_noise * n).reshape(n, q_noise)), axis=1)
np.random.seed(None)
pls_ca = pls_.PLSCanonical(n_components=3)
pls_ca.fit(X, Y)
x_weights = np.array(
[[0.65803719, 0.19197924, 0.21769083],
[0.7009113, 0.13303969, -0.15376699],
[0.13528197, -0.68636408, 0.13856546],
[0.16854574, -0.66788088, -0.12485304],
[-0.03232333, -0.04189855, 0.40690153],
[0.1148816, -0.09643158, 0.1613305],
[0.04792138, -0.02384992, 0.17175319],
[-0.06781, -0.01666137, -0.18556747],
[-0.00266945, -0.00160224, 0.11893098],
[-0.00849528, -0.07706095, 0.1570547],
[-0.00949471, -0.02964127, 0.34657036],
[-0.03572177, 0.0945091, 0.3414855],
[0.05584937, -0.02028961, -0.57682568],
[0.05744254, -0.01482333, -0.17431274]])
x_weights_sign_flip = pls_ca.x_weights_ / x_weights
x_loadings = np.array(
[[0.65649254, 0.1847647, 0.15270699],
[0.67554234, 0.15237508, -0.09182247],
[0.19219925, -0.67750975, 0.08673128],
[0.2133631, -0.67034809, -0.08835483],
[-0.03178912, -0.06668336, 0.43395268],
[0.15684588, -0.13350241, 0.20578984],
[0.03337736, -0.03807306, 0.09871553],
[-0.06199844, 0.01559854, -0.1881785],
[0.00406146, -0.00587025, 0.16413253],
[-0.00374239, -0.05848466, 0.19140336],
[0.00139214, -0.01033161, 0.32239136],
[-0.05292828, 0.0953533, 0.31916881],
[0.04031924, -0.01961045, -0.65174036],
[0.06172484, -0.06597366, -0.1244497]])
x_loadings_sign_flip = pls_ca.x_loadings_ / x_loadings
y_weights = np.array(
[[0.66101097, 0.18672553, 0.22826092],
[0.69347861, 0.18463471, -0.23995597],
[0.14462724, -0.66504085, 0.17082434],
[0.22247955, -0.6932605, -0.09832993],
[0.07035859, 0.00714283, 0.67810124],
[0.07765351, -0.0105204, -0.44108074],
[-0.00917056, 0.04322147, 0.10062478],
[-0.01909512, 0.06182718, 0.28830475],
[0.01756709, 0.04797666, 0.32225745]])
y_weights_sign_flip = pls_ca.y_weights_ / y_weights
y_loadings = np.array(
[[0.68568625, 0.1674376, 0.0969508],
[0.68782064, 0.20375837, -0.1164448],
[0.11712173, -0.68046903, 0.12001505],
[0.17860457, -0.6798319, -0.05089681],
[0.06265739, -0.0277703, 0.74729584],
[0.0914178, 0.00403751, -0.5135078],
[-0.02196918, -0.01377169, 0.09564505],
[-0.03288952, 0.09039729, 0.31858973],
[0.04287624, 0.05254676, 0.27836841]])
y_loadings_sign_flip = pls_ca.y_loadings_ / y_loadings
assert_array_almost_equal(x_loadings_sign_flip, x_weights_sign_flip, 4)
assert_array_almost_equal(np.abs(x_weights_sign_flip), 1, 4)
assert_array_almost_equal(np.abs(x_loadings_sign_flip), 1, 4)
assert_array_almost_equal(y_loadings_sign_flip, y_weights_sign_flip, 4)
assert_array_almost_equal(np.abs(y_weights_sign_flip), 1, 4)
assert_array_almost_equal(np.abs(y_loadings_sign_flip), 1, 4)
# Orthogonality of weights
# ~~~~~~~~~~~~~~~~~~~~~~~~
check_ortho(pls_ca.x_weights_, "x weights are not orthogonal")
check_ortho(pls_ca.y_weights_, "y weights are not orthogonal")
# Orthogonality of latent scores
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
check_ortho(pls_ca.x_scores_, "x scores are not orthogonal")
check_ortho(pls_ca.y_scores_, "y scores are not orthogonal")
def test_PLSSVD():
# Let's check the PLSSVD doesn't return all possible component but just
# the specified number
d = load_linnerud()
X = d.data
Y = d.target
n_components = 2
for clf in [pls_.PLSSVD, pls_.PLSRegression, pls_.PLSCanonical]:
pls = clf(n_components=n_components)
pls.fit(X, Y)
assert_equal(n_components, pls.y_scores_.shape[1])
def test_univariate_pls_regression():
# Ensure 1d Y is correctly interpreted
d = load_linnerud()
X = d.data
Y = d.target
clf = pls_.PLSRegression()
# Compare 1d to column vector
model1 = clf.fit(X, Y[:, 0]).coef_
model2 = clf.fit(X, Y[:, :1]).coef_
assert_array_almost_equal(model1, model2)
def test_predict_transform_copy():
# check that the "copy" keyword works
d = load_linnerud()
X = d.data
Y = d.target
clf = pls_.PLSCanonical()
X_copy = X.copy()
Y_copy = Y.copy()
clf.fit(X, Y)
# check that results are identical with copy
assert_array_almost_equal(clf.predict(X), clf.predict(X.copy(), copy=False))
assert_array_almost_equal(clf.transform(X), clf.transform(X.copy(), copy=False))
# check also if passing Y
assert_array_almost_equal(clf.transform(X, Y),
clf.transform(X.copy(), Y.copy(), copy=False))
# check that copy doesn't destroy
# we do want to check exact equality here
assert_array_equal(X_copy, X)
assert_array_equal(Y_copy, Y)
# also check that mean wasn't zero before (to make sure we didn't touch it)
assert_true(np.all(X.mean(axis=0) != 0))
def test_scale_and_stability():
# We test scale=True parameter
# This allows to check numerical stability over platforms as well
d = load_linnerud()
X1 = d.data
Y1 = d.target
# causes X[:, -1].std() to be zero
X1[:, -1] = 1.0
# From bug #2821
# Test with X2, T2 s.t. clf.x_score[:, 1] == 0, clf.y_score[:, 1] == 0
# This test robustness of algorithm when dealing with value close to 0
X2 = np.array([[0., 0., 1.],
[1., 0., 0.],
[2., 2., 2.],
[3., 5., 4.]])
Y2 = np.array([[0.1, -0.2],
[0.9, 1.1],
[6.2, 5.9],
[11.9, 12.3]])
for (X, Y) in [(X1, Y1), (X2, Y2)]:
X_std = X.std(axis=0, ddof=1)
X_std[X_std == 0] = 1
Y_std = Y.std(axis=0, ddof=1)
Y_std[Y_std == 0] = 1
X_s = (X - X.mean(axis=0)) / X_std
Y_s = (Y - Y.mean(axis=0)) / Y_std
for clf in [CCA(), pls_.PLSCanonical(), pls_.PLSRegression(),
pls_.PLSSVD()]:
clf.set_params(scale=True)
X_score, Y_score = clf.fit_transform(X, Y)
clf.set_params(scale=False)
X_s_score, Y_s_score = clf.fit_transform(X_s, Y_s)
assert_array_almost_equal(X_s_score, X_score)
assert_array_almost_equal(Y_s_score, Y_score)
# Scaling should be idempotent
clf.set_params(scale=True)
X_score, Y_score = clf.fit_transform(X_s, Y_s)
assert_array_almost_equal(X_s_score, X_score)
assert_array_almost_equal(Y_s_score, Y_score)
def test_pls_errors():
d = load_linnerud()
X = d.data
Y = d.target
for clf in [pls_.PLSCanonical(), pls_.PLSRegression(),
pls_.PLSSVD()]:
clf.n_components = 4
assert_raise_message(ValueError, "Invalid number of components", clf.fit, X, Y)
|
/**
* @file main.cpp
* @copyright Copyright 2019-2020 <NAME>. MIT license.
*/
#include "tcsl/tcsl.hpp"
#include "tcvm/examples.hpp"
#include "tcvm/program_options.hpp"
auto main(int argc, char** argv) -> int
{
auto cliArguments = po::variables_map {};
if (!tcvm::ProgramOptions::parse(argc, argv, cliArguments)) { return EXIT_FAILURE; }
auto arg = std::int64_t {};
if (cliArguments.count("input") != 0U)
{
arg = cliArguments["input"].as<std::int64_t>();
fmt::print("{}\n", arg);
}
auto path = std::string {};
if (cliArguments.count("file") != 0U) { path = cliArguments["file"].as<std::string>(); }
// // write binary
// {
// auto const program = tcvm::CreateFactorialProgram(arg);
// tcc::BinaryFormat::WriteToFile(path, program);
// }
// binary
auto program = tcc::BinaryProgram {};
tcc::BinaryFormat::readFromFile(path, program);
auto const stackSize = 200;
auto vm = tcc::VirtualMachine(program.data, program.entryPoint, 0, stackSize, true);
// factorial
// auto const factorial = tcvm::CreateFactorialProgram(arg);
// auto vm = tcc::VirtualMachine(factorial.data, factorial.entryPoint, 0,
// 1000, true);
vm.cpu();
return EXIT_SUCCESS;
} |
// ClearIndirectPtrSize implements the BlockWithPtrs interface for DirBlock.
func (db *DirBlock) ClearIndirectPtrSize(i int) {
if !db.IsInd {
panic("ClearIndirectPtrSize called on a direct directory block")
}
db.IPtrs[i].EncodedSize = 0
} |
# -*- encoding: utf-8 -*-
"""
==============
Classification
==============
The following example shows how to fit *auto-sklearn* to optimize for two
competing metrics: `precision` and `recall` (read more on this tradeoff
in the `scikit-learn docs <https://scikit-learn.org/stable/auto_examples/model_selection/plot_precision_recall.html>`_.
Auto-sklearn uses `SMAC3's implementation of ParEGO <https://automl.github.io/SMAC3/main/details/multi_objective.html>`_.
Multi-objective ensembling and proper access to the full Pareto set will be added in the near
future.
"""
from pprint import pprint
import matplotlib.pyplot as plt
import numpy as np
import sklearn.datasets
import sklearn.metrics
import autosklearn.classification
import autosklearn.metrics
############################################################################
# Data Loading
# ============
X, y = sklearn.datasets.fetch_openml(data_id=31, return_X_y=True, as_frame=True)
# Change the target to align with scikit-learn's convention that
# ``1`` is the minority class. In this example it is predicting
# that a credit is "bad", i.e. that it will default.
y = np.array([1 if val == "bad" else 0 for val in y])
X_train, X_test, y_train, y_test = sklearn.model_selection.train_test_split(
X, y, random_state=1
)
############################################################################
# Build and fit a classifier
# ==========================
automl = autosklearn.classification.AutoSklearnClassifier(
time_left_for_this_task=120,
metric=[autosklearn.metrics.precision, autosklearn.metrics.recall],
delete_tmp_folder_after_terminate=False,
)
automl.fit(X_train, y_train, dataset_name="German Credit")
############################################################################
# Compute the two competing metrics
# =================================
predictions = automl.predict(X_test)
print("Precision", sklearn.metrics.precision_score(y_test, predictions))
print("Recall", sklearn.metrics.recall_score(y_test, predictions))
############################################################################
# View the models found by auto-sklearn
# =====================================
# They are by default sorted by the first metric given to *auto-sklearn*.
print(automl.leaderboard())
############################################################################
# ``cv_results`` also contains both metrics
# =========================================
# Similarly to the leaderboard, they are sorted by the first metric given
# to *auto-sklearn*.
pprint(automl.cv_results_)
############################################################################
# Visualize the Pareto set
# ==========================
plot_values = []
pareto_front = automl.get_pareto_set()
for ensemble in pareto_front:
predictions = ensemble.predict(X_test)
precision = sklearn.metrics.precision_score(y_test, predictions)
recall = sklearn.metrics.recall_score(y_test, predictions)
plot_values.append((precision, recall))
fig = plt.figure()
ax = fig.add_subplot(111)
for precision, recall in plot_values:
ax.scatter(precision, recall, c="blue")
ax.set_xlabel("Precision")
ax.set_ylabel("Recall")
ax.set_title("Pareto set")
plt.show()
|
/**
* Returns a default configuration appropriate to the current operating system.
*
* <p>More specifically, if the operating system is Windows, {@link Configuration#windows()} is
* returned; if the operating system is Mac OS X, {@link Configuration#osX()} is returned;
* otherwise, {@link Configuration#unix()} is returned.
*
* <p>This is the configuration used by the {@code Jimfs.newFileSystem} methods that do not take a
* {@code Configuration} parameter.
*
* @since 1.1
*/
public static Configuration forCurrentPlatform() {
String os = System.getProperty("os.name");
if (os.contains("Windows")) {
return windows();
} else if (os.contains("OS X")) {
return osX();
} else {
return unix();
}
} |
def next_face(self,f,p1,vec):
vlist=[f.vertex(i) for i in range(3)]
pnts = np.array( [ [v.point().x(),v.point().y()] for v in vlist] )
left_vec = np.array( [-vec[1],vec[0]] )
left_distance = [ (pnts[i,0] - p1[0])*left_vec[0] + (pnts[i,1]-p1[1])*left_vec[1] for i in range(3)]
for i in range(3):
if left_distance[i] <= 0 and left_distance[(i+1)%3] > 0:
break
edge = (f,(i-1)%3)
new_face = f.neighbor( (i-1)%3 )
return edge,new_face |
def connect_to_twitter_stream(self):
try:
self.initialize_listener()
self.initialize_twitter_stream()
self._thread = Thread(target=self._run, daemon=True)
self._thread.start()
except:
log.exception('Exception caught while trying to connect to the twitter stream') |
<reponame>sutao80216/GDevelop<filename>GDCpp/GDCpp/IDE/Dialogs/EditCppCodeEvent.cpp
/*
* GDevelop C++ Platform
* Copyright 2008-2016 <NAME> (<EMAIL>). All rights
* reserved. This project is released under the MIT License.
*/
#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI)
#include "EditCppCodeEvent.h"
//(*InternalHeaders(EditCppCodeEvent)
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/settings.h>
#include <wx/string.h>
#include "GDCore/Tools/Localization.h"
//*)
#include <wx/config.h>
#include <wx/filename.h>
#include <wx/textfile.h>
#include <fstream>
#include "GDCore/IDE/Dialogs/ChooseObjectDialog.h"
#include "GDCore/IDE/Dialogs/EventsEditor/EventsRenderingHelper.h"
#include "GDCore/Project/SourceFile.h"
#include "GDCpp/Events/Builtin/CppCodeEvent.h"
#include "GDCpp/IDE/CodeCompiler.h"
#include "GDCpp/Runtime/CommonTools.h"
#include "GDCpp/Runtime/Project/Layout.h"
#include "GDCpp/Runtime/Project/Project.h"
//(*IdInit(EditCppCodeEvent)
const long EditCppCodeEvent::ID_STATICBITMAP3 = wxNewId();
const long EditCppCodeEvent::ID_STATICTEXT3 = wxNewId();
const long EditCppCodeEvent::ID_PANEL1 = wxNewId();
const long EditCppCodeEvent::ID_STATICLINE2 = wxNewId();
const long EditCppCodeEvent::ID_CHECKBOX2 = wxNewId();
const long EditCppCodeEvent::ID_CHECKBOX1 = wxNewId();
const long EditCppCodeEvent::ID_TEXTCTRL3 = wxNewId();
const long EditCppCodeEvent::ID_BITMAPBUTTON1 = wxNewId();
const long EditCppCodeEvent::ID_CHECKLISTBOX1 = wxNewId();
const long EditCppCodeEvent::ID_STATICTEXT1 = wxNewId();
const long EditCppCodeEvent::ID_TEXTCTRL1 = wxNewId();
const long EditCppCodeEvent::ID_CHECKBOX3 = wxNewId();
const long EditCppCodeEvent::ID_TEXTCTRL2 = wxNewId();
const long EditCppCodeEvent::ID_STATICTEXT5 = wxNewId();
const long EditCppCodeEvent::ID_CUSTOM1 = wxNewId();
const long EditCppCodeEvent::ID_STATICTEXT4 = wxNewId();
const long EditCppCodeEvent::ID_STATICLINE1 = wxNewId();
const long EditCppCodeEvent::ID_BUTTON1 = wxNewId();
const long EditCppCodeEvent::ID_BUTTON2 = wxNewId();
//*)
BEGIN_EVENT_TABLE(EditCppCodeEvent, wxDialog)
//(*EventTable(EditCppCodeEvent)
//*)
END_EVENT_TABLE()
enum { MARGIN_LINE_NUMBERS, MARGIN_FOLD };
EditCppCodeEvent::EditCppCodeEvent(wxWindow* parent,
CppCodeEvent& event_,
gd::Project& game_,
gd::Layout& scene_)
: editedEvent(event_), game(game_), scene(scene_) {
//(*Initialize(EditCppCodeEvent)
wxStaticBoxSizer* StaticBoxSizer2;
wxFlexGridSizer* FlexGridSizer4;
wxStaticBoxSizer* StaticBoxSizer4;
wxFlexGridSizer* FlexGridSizer10;
wxFlexGridSizer* FlexGridSizer3;
wxFlexGridSizer* FlexGridSizer5;
wxFlexGridSizer* FlexGridSizer9;
wxFlexGridSizer* FlexGridSizer2;
wxFlexGridSizer* FlexGridSizer7;
wxFlexGridSizer* FlexGridSizer15;
wxFlexGridSizer* FlexGridSizer8;
wxFlexGridSizer* FlexGridSizer14;
wxFlexGridSizer* FlexGridSizer13;
wxFlexGridSizer* FlexGridSizer12;
wxFlexGridSizer* FlexGridSizer6;
wxStaticBoxSizer* StaticBoxSizer1;
wxFlexGridSizer* FlexGridSizer1;
wxFlexGridSizer* FlexGridSizer11;
wxFlexGridSizer* FlexGridSizer17;
wxStaticBoxSizer* StaticBoxSizer5;
Create(parent,
wxID_ANY,
_("C++ code"),
wxDefaultPosition,
wxDefaultSize,
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxMAXIMIZE_BOX,
_T("wxID_ANY"));
FlexGridSizer2 = new wxFlexGridSizer(0, 1, 0, 0);
FlexGridSizer2->AddGrowableCol(0);
FlexGridSizer2->AddGrowableRow(1);
FlexGridSizer17 = new wxFlexGridSizer(0, 1, 0, 0);
FlexGridSizer17->AddGrowableCol(0);
Panel1 = new wxPanel(this,
ID_PANEL1,
wxDefaultPosition,
wxDefaultSize,
wxTAB_TRAVERSAL,
_T("ID_PANEL1"));
Panel1->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW));
FlexGridSizer6 = new wxFlexGridSizer(0, 3, 0, 0);
FlexGridSizer6->AddGrowableCol(1);
StaticBitmap3 =
new wxStaticBitmap(Panel1,
ID_STATICBITMAP3,
wxBitmap(wxImage(_T("res/source_cpp64.png"))),
wxDefaultPosition,
wxDefaultSize,
wxNO_BORDER,
_T("ID_STATICBITMAP3"));
FlexGridSizer6->Add(
StaticBitmap3, 1, wxALL | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 5);
StaticText3 = new wxStaticText(
Panel1,
ID_STATICTEXT3,
_("The C++ code events allow you to call a function written in "
"C++,\nwith if needed the scene or some objects passed as "
"arguments.\nYou can also specify the external source files which must "
"be compiled\nif your function is refering to features implemented in "
"external source files."),
wxDefaultPosition,
wxSize(760, 75),
0,
_T("ID_STATICTEXT3"));
FlexGridSizer6->Add(StaticText3,
1,
wxALL | wxEXPAND | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL,
5);
Panel1->SetSizer(FlexGridSizer6);
FlexGridSizer6->Fit(Panel1);
FlexGridSizer6->SetSizeHints(Panel1);
FlexGridSizer17->Add(
Panel1,
1,
wxALL | wxEXPAND | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL,
0);
StaticLine2 = new wxStaticLine(this,
ID_STATICLINE2,
wxDefaultPosition,
wxSize(10, -1),
wxLI_HORIZONTAL,
_T("ID_STATICLINE2"));
FlexGridSizer17->Add(
StaticLine2,
1,
wxALL | wxEXPAND | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL,
0);
FlexGridSizer2->Add(
FlexGridSizer17,
1,
wxALL | wxEXPAND | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL,
0);
FlexGridSizer3 = new wxFlexGridSizer(0, 1, 0, 0);
FlexGridSizer3->AddGrowableCol(0);
FlexGridSizer3->AddGrowableRow(0);
FlexGridSizer9 = new wxFlexGridSizer(0, 3, 0, 0);
FlexGridSizer9->AddGrowableCol(1);
FlexGridSizer9->AddGrowableRow(0);
FlexGridSizer11 = new wxFlexGridSizer(0, 3, 0, 0);
FlexGridSizer11->AddGrowableCol(0);
FlexGridSizer11->AddGrowableRow(0);
FlexGridSizer12 = new wxFlexGridSizer(0, 1, 0, 0);
FlexGridSizer12->AddGrowableCol(0);
FlexGridSizer12->AddGrowableRow(1);
StaticBoxSizer2 =
new wxStaticBoxSizer(wxHORIZONTAL, this, _("Call to function"));
FlexGridSizer7 = new wxFlexGridSizer(0, 1, 0, 0);
FlexGridSizer7->AddGrowableCol(0);
sceneRefCheck = new wxCheckBox(this,
ID_CHECKBOX2,
_("Pass a reference to the scene"),
wxDefaultPosition,
wxDefaultSize,
0,
wxDefaultValidator,
_T("ID_CHECKBOX2"));
sceneRefCheck->SetValue(true);
FlexGridSizer7->Add(
sceneRefCheck, 1, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 5);
FlexGridSizer8 = new wxFlexGridSizer(0, 1, 0, 0);
FlexGridSizer8->AddGrowableCol(0);
objectsListCheck = new wxCheckBox(this,
ID_CHECKBOX1,
_("Pass a list of pointers to objects:"),
wxDefaultPosition,
wxDefaultSize,
0,
wxDefaultValidator,
_T("ID_CHECKBOX1"));
objectsListCheck->SetValue(false);
FlexGridSizer8->Add(
objectsListCheck, 1, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 5);
FlexGridSizer13 = new wxFlexGridSizer(0, 3, 0, 0);
FlexGridSizer13->AddGrowableCol(1);
FlexGridSizer13->Add(
15,
15,
1,
wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL,
0);
objectPassedAsParameterEdit = new wxTextCtrl(this,
ID_TEXTCTRL3,
wxEmptyString,
wxDefaultPosition,
wxSize(111, 21),
0,
wxDefaultValidator,
_T("ID_TEXTCTRL3"));
FlexGridSizer13->Add(
objectPassedAsParameterEdit,
1,
wxALL | wxEXPAND | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL,
5);
objectBt = new wxBitmapButton(this,
ID_BITMAPBUTTON1,
wxBitmap(wxImage(_T("res/objeticon.png"))),
wxDefaultPosition,
wxDefaultSize,
wxBU_AUTODRAW,
wxDefaultValidator,
_T("ID_BITMAPBUTTON1"));
objectBt->SetDefault();
FlexGridSizer13->Add(
objectBt,
1,
wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL,
5);
FlexGridSizer8->Add(
FlexGridSizer13,
1,
wxALL | wxEXPAND | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL,
0);
FlexGridSizer7->Add(
FlexGridSizer8,
1,
wxALL | wxEXPAND | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL,
0);
StaticBoxSizer2->Add(
FlexGridSizer7,
1,
wxALL | wxEXPAND | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL,
0);
FlexGridSizer12->Add(
StaticBoxSizer2,
1,
wxALL | wxEXPAND | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL,
5);
StaticBoxSizer4 = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Dependencies"));
FlexGridSizer14 = new wxFlexGridSizer(0, 1, 0, 0);
FlexGridSizer14->AddGrowableCol(0);
FlexGridSizer14->AddGrowableRow(0);
dependenciesList = new wxCheckListBox(this,
ID_CHECKLISTBOX1,
wxDefaultPosition,
wxSize(224, 129),
0,
0,
0,
wxDefaultValidator,
_T("ID_CHECKLISTBOX1"));
FlexGridSizer14->Add(
dependenciesList,
1,
wxALL | wxEXPAND | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL,
0);
StaticBoxSizer4->Add(
FlexGridSizer14,
1,
wxALL | wxEXPAND | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL,
0);
FlexGridSizer12->Add(
StaticBoxSizer4,
1,
wxALL | wxEXPAND | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL,
5);
StaticBoxSizer5 =
new wxStaticBoxSizer(wxHORIZONTAL, this, _("Events editor displaying"));
FlexGridSizer15 = new wxFlexGridSizer(0, 1, 0, 0);
FlexGridSizer15->AddGrowableCol(0);
StaticText1 = new wxStaticText(this,
ID_STATICTEXT1,
_("Name/Comment displayed for the event:"),
wxDefaultPosition,
wxDefaultSize,
0,
_T("ID_STATICTEXT1"));
FlexGridSizer15->Add(
StaticText1, 1, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 5);
displayedNameEdit = new wxTextCtrl(this,
ID_TEXTCTRL1,
wxEmptyString,
wxDefaultPosition,
wxSize(209, 21),
0,
wxDefaultValidator,
_T("ID_TEXTCTRL1"));
FlexGridSizer15->Add(
displayedNameEdit,
1,
wxALL | wxEXPAND | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL,
5);
displayCodeCheck = new wxCheckBox(this,
ID_CHECKBOX3,
_("Display the code in the events editor"),
wxDefaultPosition,
wxDefaultSize,
0,
wxDefaultValidator,
_T("ID_CHECKBOX3"));
displayCodeCheck->SetValue(false);
FlexGridSizer15->Add(
displayCodeCheck, 1, wxALL | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 5);
StaticBoxSizer5->Add(
FlexGridSizer15,
1,
wxALL | wxEXPAND | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL,
0);
FlexGridSizer12->Add(
StaticBoxSizer5,
1,
wxALL | wxEXPAND | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL,
5);
FlexGridSizer11->Add(
FlexGridSizer12,
1,
wxALL | wxEXPAND | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL,
0);
FlexGridSizer9->Add(
FlexGridSizer11,
1,
wxALL | wxEXPAND | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL,
0);
FlexGridSizer10 = new wxFlexGridSizer(0, 1, 0, 0);
FlexGridSizer10->AddGrowableCol(0);
FlexGridSizer10->AddGrowableRow(1);
StaticBoxSizer1 = new wxStaticBoxSizer(wxHORIZONTAL, this, _("Includes"));
FlexGridSizer1 = new wxFlexGridSizer(0, 2, 0, 0);
FlexGridSizer1->AddGrowableCol(0);
includeTextCtrl = new wxTextCtrl(this,
ID_TEXTCTRL2,
wxEmptyString,
wxDefaultPosition,
wxDefaultSize,
wxTE_MULTILINE,
wxDefaultValidator,
_T("ID_TEXTCTRL2"));
FlexGridSizer1->Add(
includeTextCtrl,
1,
wxALL | wxEXPAND | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL,
5);
StaticBoxSizer1->Add(
FlexGridSizer1,
1,
wxALL | wxEXPAND | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL,
0);
FlexGridSizer10->Add(
StaticBoxSizer1,
1,
wxALL | wxEXPAND | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL,
5);
FlexGridSizer4 = new wxFlexGridSizer(0, 1, 0, 0);
FlexGridSizer4->AddGrowableCol(0);
FlexGridSizer4->AddGrowableRow(1);
functionPrototypeTxt = new wxStaticText(this,
ID_STATICTEXT5,
_("void Function()\n{"),
wxDefaultPosition,
wxDefaultSize,
0,
_T("ID_STATICTEXT5"));
FlexGridSizer4->Add(functionPrototypeTxt,
1,
wxTOP | wxLEFT | wxRIGHT | wxEXPAND | wxALIGN_LEFT |
wxALIGN_CENTER_VERTICAL,
5);
codeEdit = new wxStyledTextCtrl(this,
ID_CUSTOM1,
wxDefaultPosition,
wxSize(460, 40),
0,
_T("ID_CUSTOM1"));
FlexGridSizer4->Add(
codeEdit,
1,
wxALL | wxEXPAND | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL,
5);
StaticText4 = new wxStaticText(this,
ID_STATICTEXT4,
_("}"),
wxDefaultPosition,
wxDefaultSize,
0,
_T("ID_STATICTEXT4"));
FlexGridSizer4->Add(
StaticText4,
1,
wxBOTTOM | wxLEFT | wxRIGHT | wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL,
5);
FlexGridSizer10->Add(
FlexGridSizer4,
1,
wxALL | wxEXPAND | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL,
0);
FlexGridSizer9->Add(
FlexGridSizer10,
1,
wxALL | wxEXPAND | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL,
0);
FlexGridSizer3->Add(
FlexGridSizer9,
1,
wxALL | wxEXPAND | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL,
0);
FlexGridSizer2->Add(
FlexGridSizer3,
1,
wxALL | wxEXPAND | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL,
0);
StaticLine1 = new wxStaticLine(this,
ID_STATICLINE1,
wxDefaultPosition,
wxSize(10, -1),
wxLI_HORIZONTAL,
_T("ID_STATICLINE1"));
FlexGridSizer2->Add(
StaticLine1,
1,
wxALL | wxEXPAND | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL,
0);
FlexGridSizer5 = new wxFlexGridSizer(0, 3, 0, 0);
okBt = new wxButton(this,
ID_BUTTON1,
_("Ok"),
wxDefaultPosition,
wxDefaultSize,
0,
wxDefaultValidator,
_T("ID_BUTTON1"));
FlexGridSizer5->Add(
okBt, 1, wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL, 5);
cancelBt = new wxButton(this,
ID_BUTTON2,
_("Cancel"),
wxDefaultPosition,
wxDefaultSize,
0,
wxDefaultValidator,
_T("ID_BUTTON2"));
FlexGridSizer5->Add(
cancelBt,
1,
wxALL | wxALIGN_CENTER_HORIZONTAL | wxALIGN_CENTER_VERTICAL,
5);
FlexGridSizer2->Add(
FlexGridSizer5, 1, wxALL | wxALIGN_RIGHT | wxALIGN_CENTER_VERTICAL, 0);
SetSizer(FlexGridSizer2);
FlexGridSizer2->Fit(this);
FlexGridSizer2->SetSizeHints(this);
Connect(ID_CHECKBOX2,
wxEVT_COMMAND_CHECKBOX_CLICKED,
(wxObjectEventFunction)&EditCppCodeEvent::OnsceneRefCheckClick);
Connect(ID_CHECKBOX1,
wxEVT_COMMAND_CHECKBOX_CLICKED,
(wxObjectEventFunction)&EditCppCodeEvent::OnobjectsListCheckClick);
Connect(ID_BITMAPBUTTON1,
wxEVT_COMMAND_BUTTON_CLICKED,
(wxObjectEventFunction)&EditCppCodeEvent::OnobjectBtClick);
Connect(ID_BUTTON1,
wxEVT_COMMAND_BUTTON_CLICKED,
(wxObjectEventFunction)&EditCppCodeEvent::OnokBtClick);
Connect(ID_BUTTON2,
wxEVT_COMMAND_BUTTON_CLICKED,
(wxObjectEventFunction)&EditCppCodeEvent::OncancelBtClick);
//*)
Connect(ID_CUSTOM1,
wxEVT_STC_UPDATEUI,
(wxObjectEventFunction)&EditCppCodeEvent::UpdateTextCtrl);
codeEdit->SetLexer(wxSTC_LEX_CPP);
codeEdit->StyleSetFont(wxSTC_STYLE_DEFAULT,
gd::EventsRenderingHelper::Get()->GetFont());
codeEdit->StyleSetBackground(34, wxColour(119, 255, 119)); // Brace
codeEdit->StyleSetBackground(35, wxColour(255, 119, 119)); // Brace
codeEdit->StyleSetForeground(wxSTC_C_STRING, *wxBLUE);
codeEdit->StyleSetForeground(wxSTC_C_OPERATOR, *wxRED);
codeEdit->StyleSetForeground(wxSTC_C_IDENTIFIER, wxColour(40, 0, 60));
codeEdit->StyleSetForeground(wxSTC_C_CHARACTER, wxColour(150, 0, 0));
codeEdit->StyleSetForeground(wxSTC_C_WORD, wxColour(0, 0, 150));
codeEdit->StyleSetForeground(wxSTC_C_WORD2, wxColour(0, 150, 0));
codeEdit->StyleSetForeground(wxSTC_C_COMMENT, wxColour(0, 78, 193));
codeEdit->StyleSetForeground(wxSTC_C_COMMENTLINE, wxColour(0, 78, 193));
codeEdit->StyleSetForeground(wxSTC_C_COMMENTLINEDOC, wxColour(0, 78, 193));
codeEdit->StyleSetForeground(wxSTC_C_NUMBER, wxColour(203, 73, 170));
codeEdit->StyleSetBold(wxSTC_C_WORD, true);
codeEdit->StyleSetBold(wxSTC_C_WORD2, true);
codeEdit->StyleSetBold(wxSTC_C_COMMENTDOCKEYWORD, true);
codeEdit->SetKeyWords(
0,
wxT("_Char16_t _Char32_t align_union alignof asm auto bool break case "
"catch char class const const_cast constexpr continue decltype "
"default delete do double dynamic_cast else enum explicit export "
"extern false final float for friend goto if import inline int long "
"mutable namespace new nullptr operator override private protected "
"public register reinterpret_cast return short signed sizeof static "
"static_cast struct switch template this throw true try typedef "
"typeid typename union unsigned using virtual void volatile wchar_t "
"while static_assert int8_t uint8_t int16_t uint16_t int32_t "
"uint32_t int64_t uint64_t int_least8_t uint_least8_t int_least16_t "
"uint_least16_t int_least32_t uint_least32_t int_least64_t "
"uint_least64_t int_fast8_t uint_fast8_t int_fast16_t uint_fast16_t "
"int_fast32_t uint_fast32_t int_fast64_t uint_fast64_t intptr_t "
"uintptr_t intmax_t uintmax_t wint_t wchar_t wctrans_t wctype_t "
"size_t time_t and and_eq bitand bitor compl not not_eq or or_eq xor "
"xor_eq"));
codeEdit->SetKeyWords(
1,
wxT("__gnu_cxx accumulate add_const add_cv add_lvalue_reference "
"add_pointer add_reference add_rvalue_reference add_volatile "
"adjacent_difference adjacent_find aligned_storage Alignment "
"alignment_of all_of allocate_shared allocator allocator_base "
"allocator_chunklist allocator_fixed_size allocator_newdel "
"allocator_suballoc allocator_unbounded allocator_variable_size "
"any_of array assign at atomic_bool atomic_char atomic_char16_t "
"atomic_char32_t atomic_compare_exchange_strong "
"atomic_compare_exchange_strong_explicit "
"atomic_compare_exchange_weak atomic_compare_exchange_weak_explicit "
"atomic_exchange atomic_exchange_explicit atomic_fetch_add "
"atomic_fetch_and atomic_fetch_or atomic_fetch_sub atomic_fetch_xor "
"atomic_int atomic_int_fast16_t atomic_int_fast32_t "
"atomic_int_fast64_t atomic_int_fast8_t atomic_int_least16_t "
"atomic_int_least32_t atomic_int_least64_t atomic_int_least8_t "
"atomic_intmax_t atomic_intptr_t atomic_is_lock_free atomic_llong "
"atomic_load atomic_load_explicit atomic_long atomic_ptrdiff_t "
"atomic_schar atomic_short atomic_size_t atomic_ssize_t atomic_store "
"atomic_store_explicit atomic_uchar atomic_uint atomic_uint_fast16_t "
"atomic_uint_fast32_t atomic_uint_fast64_t atomic_uint_fast8_t "
"atomic_uint_least16_t atomic_uint_least32_t atomic_uint_least64_t "
"atomic_uint_least8_t atomic_uintmax_t atomic_uintptr_t "
"atomic_ullong atomic_ulong atomic_ushort atomic_wchar_t auto_ptr "
"back back_insert_iterator back_item bad_alloc bad_function_call "
"bad_weak_ptr basic_filebuf basic_fstream basic_ifstream "
"basic_ofstream basic_regex basic_streambuf basic_string begin "
"bernoulli_distribution bidirectional_iterator_tag binary_function "
"binary_negate binary_search bind bind1st bind2nd binder1st "
"binder2nd binomial_distribution bit_and bit_or bit_xor bitset boost "
"cache_chunklist cache_freelist cache_suballoc cauchy_distribution "
"cbegin cend cerr char_traits checked_array_iterator "
"checked_uninitialized_copy checked_uninitialized_fill_n "
"chi_squared_distribution cin clear codecvt codecvt_base "
"codecvt_byname codecvt_mode codecvt_utf16 codecvt_utf8 "
"codecvt_utf8_utf16 collate collate_byname common_type "
"compare_exchange_strong compare_exchange_weak complex "
"condition_variable conditional const_iterator const_mem_fun_ref_t "
"const_mem_fun_t const_mem_fun1_ref_t const_mem_fun1_t "
"const_pointer_cast const_reference const_reverse_iterator copy "
"copy_backward copy_if copy_n count count_if cout crbegin cref crend "
"ctype ctype_base ctype_byname decay declare_no_pointers "
"declare_reachable declval default_delete default_random_engine "
"deque difference_type discard_block discard_block_engine "
"discrete_distribution divides domain_error dynamic_pointer_cast "
"empty enable_if enable_shared_from_this end equal equal_range "
"equal_to EqualityComparable erase error_category error_code "
"error_condition exception exponential_distribution extent "
"extreme_value_distribution fetch_add fetch_and fetch_or fetch_sub "
"fetch_xor filebuf fill fill_n find find_end find_first_of find_if "
"find_if_not fisher_f_distribution float_denorm_style "
"float_round_style for_each forward forward_iterator_tag "
"forward_list freelist front front_insert_iterator front_item "
"fstream function gamma_distribution generate generate_n "
"generic_container generic_iterator generic_reverse_iterator "
"generic_value geometric_distribution get_deleter get_pointer_safety "
"get_temporary_buffer greater greater_equal has_nothrow_assign "
"has_nothrow_constructor has_nothrow_copy has_nothrow_copy_assign "
"has_nothrow_copy_constructor has_nothrow_default_constructor "
"has_trivial_assign has_trivial_constructor has_trivial_copy "
"has_trivial_copy_assign has_trivial_copy_constructor "
"has_trivial_default_constructor has_trivial_destructor "
"has_virtual_destructor hash hash_map hash_set ifstream includes "
"independent_bits_engine initializer_list inner_product "
"inplace_merge input_iterator_tag insert insert_iterator "
"integral_constant invalid_argument iostream is_abstract "
"is_arithmetic is_array is_base_of is_bind_expression is_class "
"is_compound is_const is_constructible is_convertible is_empty "
"is_enum is_error_code_enum is_error_condition_enum "
"is_explicitly_convertible is_floating_point is_function "
"is_fundamental is_heap is_heap_until is_integral is_literal_type "
"is_lock_free is_lvalue_reference is_member_function_pointer "
"is_member_object_pointer is_member_pointer is_nothrow_constructible "
"is_object is_partitioned is_placeholder is_pod is_pointer "
"is_polymorphic is_reference is_rvalue_reference is_same is_scalar "
"is_signed is_sorted is_sorted_until is_standard_layout is_trivial "
"is_union is_unsigned is_void is_volatile istream istream_iterator "
"istreambuf_iterator iter_swap iterator iterator_traits knuth_b "
"length_error less less_equal LessThanComparable "
"lexicographical_compare linear_congruential "
"linear_congruential_engine list locale logic_error logical_and "
"logical_not logical_or lognormal_distribution lower_bound "
"make_checked_array_iterator make_heap make_shared make_signed "
"make_unsigned map match_results max max_element max_fixed_size "
"max_none max_unbounded max_variable_size mem_fn mem_fun mem_fun_ref "
"mem_fun_ref_t mem_fun_t mem_fun1_ref_t mem_fun1_t merge "
"mersenne_twister mersenne_twister_engine messages messages_base "
"messages_byname min min_element minmax minmax_element minstd_rand "
"minstd_rand0 minus mismatch modulus money_base money_get money_put "
"moneypunct moneypunct_byname move move_backward move_iterator "
"mt19937 mt19937_64 multimap multiplies multiset negate "
"negative_binomial_distribution new_handler next_permutation none_of "
"normal_distribution not_equal_to not1 not2 nothrow nothrow_t "
"nth_element num_get num_put numeric_limits numpunct numpunct_byname "
"ofstream ostream_iterator ostreambuf_iterator out_of_range "
"output_iterator_tag overflow_error owner_less pair partial_sort "
"partial_sort_copy partial_sum partition partition_copy "
"partition_point piecewise_constant_distribution "
"piecewise_linear_distribution plus pointer_safety "
"pointer_to_binary_function pointer_to_unary_function "
"poisson_distribution pop_back pop_front pop_heap prev_permutation "
"priority_queue ptr_fun push_back push_front push_heap queue "
"random_access_iterator_tag random_device random_shuffle range_error "
"rank ranlux_base_01 ranlux24 ranlux24_base ranlux3 ranlux3_01 "
"ranlux4 ranlux4_01 ranlux48 ranlux48_base ranlux64_base_01 ratio "
"ratio_add ratio_divide ratio_multiply ratio_subtract "
"raw_storage_iterator rbegin ref reference reference_wrapper regex "
"regex_constants regex_error regex_iterator regex_token_iterator "
"regex_traits remove remove_all_extents remove_const remove_copy "
"remove_copy_if remove_cv remove_extent remove_if remove_pointer "
"remove_reference remove_volatile rend replace replace_copy "
"replace_copy_if replace_if requires resize result_of "
"return_temporary_buffer reverse reverse_copy reverse_iterator "
"rotate rotate_copy rts_alloc runtime_error search search_n seed_seq "
"set set_difference set_intersection set_new_handler "
"set_symmetric_difference set_union shared_ptr shuffle_order_engine "
"size size_type sort sort_heap stable_partition stable_sort stack "
"static_pointer_cast std string student_t_distribution sub_match "
"subtract_with_carry subtract_with_carry_01 "
"subtract_with_carry_engine swap swap_ranges sync_none "
"sync_per_container sync_per_thread sync_shared system_error "
"time_base time_get time_get_byname time_put time_put_byname "
"to_array tr1 transform tuple tuple_element tuple_size type_info "
"unary_function unary_negate unchecked_uninitialized_copy "
"unchecked_uninitialized_fill_n undeclare_no_pointers "
"undeclare_reachable underflow_error uniform_int "
"uniform_int_distribution uniform_real uniform_real_distribution "
"uninitialized_copy uninitialized_copy_n uninitialized_fill "
"uninitialized_fill_n unique unique_copy unique_ptr unordered_map "
"unordered_multimap unordered_multiset unordered_set upper_bound "
"valarray value_type variate_generator vector wcerr wcin wcout "
"weak_ptr weibull_distribution wfilebuf wfstream wifstream wiostream "
"wistream wofstream wregex xor_combine"));
codeEdit->SetKeyWords(
2,
wxT("a addindex addtogroup anchor arg attention author b brief bug c "
"class code date def defgroup deprecated dontinclude e em endcode "
"endhtmlonly endif endlatexonly endlink endverbatim enum example "
"exception f$ f[ f] file fn hideinitializer htmlinclude htmlonly if "
"image include ingroup internal invariant interface latexonly li "
"line link mainpage name namespace nosubgrouping note overload p "
"page par param post pre ref relates remarks return retval sa "
"section see showinitializer since skip skipline struct subsection "
"test throw todo typedef union until var verbatim verbinclude "
"version warning weakgroup $ @ \\ < > # { }"));
codeEdit->SetTabWidth(4);
codeEdit->SetMarginWidth(MARGIN_LINE_NUMBERS, 20);
codeEdit->StyleSetForeground(wxSTC_STYLE_LINENUMBER, wxColour(75, 75, 75));
codeEdit->StyleSetBackground(wxSTC_STYLE_LINENUMBER, wxColour(220, 220, 220));
codeEdit->SetMarginType(MARGIN_LINE_NUMBERS, wxSTC_MARGIN_NUMBER);
// Load values from the event
codeEdit->SetText(editedEvent.GetInlineCode());
for (std::size_t i = 0; i < editedEvent.GetIncludeFiles().size(); ++i) {
includeTextCtrl->AppendText(editedEvent.GetIncludeFiles()[i]);
if (i != editedEvent.GetIncludeFiles().size() - 1)
includeTextCtrl->AppendText("\n");
}
sceneRefCheck->SetValue(editedEvent.GetPassSceneAsParameter());
objectsListCheck->SetValue(editedEvent.GetPassObjectListAsParameter());
objectPassedAsParameterEdit->SetValue(
editedEvent.GetObjectToPassAsParameter());
displayedNameEdit->SetValue(editedEvent.GetDisplayedName());
displayCodeCheck->SetValue(editedEvent.IsCodeDisplayedInEditor());
const auto& allFiles = game.GetAllSourceFiles();
for (std::size_t i = 0; i < allFiles.size(); ++i) {
if (allFiles[i]->IsGDManaged()) continue;
if (allFiles[i]->GetLanguage() != "C++") continue;
dependenciesList->Append(allFiles[i]->GetFileName());
if (std::find(editedEvent.GetSourceFileDependencies().begin(),
editedEvent.GetSourceFileDependencies().end(),
allFiles[i]->GetFileName()) !=
editedEvent.GetSourceFileDependencies().end()) {
dependenciesList->Check(dependenciesList->GetCount() - 1, true);
}
}
UpdateFunctionPrototype();
}
EditCppCodeEvent::~EditCppCodeEvent() {
//(*Destroy(EditCppCodeEvent)
//*)
}
void EditCppCodeEvent::OnokBtClick(wxCommandEvent& event) {
editedEvent.SetInlineCode(codeEdit->GetText());
editedEvent.SetIncludeFiles(
gd::String(includeTextCtrl->GetValue()).Split(U'\n'));
editedEvent.SetPassSceneAsParameter(sceneRefCheck->GetValue());
editedEvent.SetPassObjectListAsParameter(objectsListCheck->GetValue());
editedEvent.SetObjectToPassAsParameter(
objectPassedAsParameterEdit->GetValue());
editedEvent.SetDisplayedName(displayedNameEdit->GetValue());
editedEvent.EnableCodeDisplayedInEditor(displayCodeCheck->GetValue());
std::vector<gd::String> dependencies;
std::size_t listIndex = 0;
const auto& allFiles = game.GetAllSourceFiles();
for (std::size_t i = 0; i < allFiles.size(); ++i) {
if (allFiles[i]->IsGDManaged()) continue;
if (allFiles[i]->GetLanguage() != "C++") continue;
if (dependenciesList->IsChecked(listIndex))
dependencies.push_back(allFiles[i]->GetFileName());
listIndex++;
}
editedEvent.SetDependencies(dependencies);
editedEvent.SetLastChangeTimeStamp(wxDateTime::Now().GetTicks());
editedEvent.EnsureAssociatedSourceFileIsUpToDate(game);
EndModal(1);
}
void EditCppCodeEvent::OncancelBtClick(wxCommandEvent& event) { EndModal(0); }
void EditCppCodeEvent::OnobjectBtClick(wxCommandEvent& event) {
gd::ChooseObjectDialog dialog(this, game, scene, true);
if (dialog.ShowModal() == 1)
objectPassedAsParameterEdit->ChangeValue(dialog.GetChosenObject());
return;
}
void EditCppCodeEvent::UpdateFunctionPrototype() {
functionPrototypeTxt->SetLabel(
gd::String("void Function(") +
(sceneRefCheck->GetValue() ? gd::String("RuntimeScene & scene")
: gd::String("")) +
((sceneRefCheck->GetValue() && objectsListCheck->GetValue()) ? ", "
: "") +
(objectsListCheck->GetValue()
? gd::String("std::vector<RuntimeObject*> objectsList")
: "") +
")\n{");
}
void EditCppCodeEvent::OnobjectsListCheckClick(wxCommandEvent& event) {
UpdateFunctionPrototype();
}
void EditCppCodeEvent::OnsceneRefCheckClick(wxCommandEvent& event) {
UpdateFunctionPrototype();
}
/**
* Syntax highlighting
*/
void EditCppCodeEvent::UpdateTextCtrl(wxStyledTextEvent& event) {
char currentChar = codeEdit->GetCharAt(codeEdit->GetCurrentPos());
if (currentChar != '(' && currentChar != ')') {
codeEdit->BraceHighlight(wxSTC_INVALID_POSITION, wxSTC_INVALID_POSITION);
return;
}
int otherBrace = codeEdit->BraceMatch(codeEdit->GetCurrentPos());
if (otherBrace != wxSTC_INVALID_POSITION)
codeEdit->BraceHighlight(codeEdit->GetCurrentPos(), otherBrace);
else
codeEdit->BraceBadLight(codeEdit->GetCurrentPos());
}
#endif
|
<filename>src/java_multi_thread_programming/c1/s5/Run.java
package java_multi_thread_programming.c1.s5;
public class Run {
public static void main(String[] args) {
MyThread myThread = new MyThread();
System.out.println(System.currentTimeMillis());
myThread.run();
// myThread.start();
System.out.println(System.currentTimeMillis());
}
}
|
def vectorFeature(self, vectorStrokes):
if (self.vecDimensions < 2):
print "Must have at least 2 dimensions"
return -1
origin = [0.0 for _ in xrange(self.vecDimensions)]
k = 0
for vectorStroke in vectorStrokes:
for vector in vectorStroke:
self.addVectorDimension(vector, origin, k)
k = (k + 1) % self.vecDimensions
return origin |
/**
* Run the command.
*
* @param command
* a list containing the operating system program and its
* arguments. See
* {@link java.lang.ProcessBuilder#ProcessBuilder(List)}.
*/
public void run(List<String> command) throws ProcessException {
try {
ProcessBuilder builder = new ProcessBuilder(command);
if (workingDirectory != null) {
builder.directory(workingDirectory);
}
if (!environmentAdditions.isEmpty()) {
builder.environment().putAll(this.environmentAdditions);
}
Process process = builder.start();
StreamEater outputEater = new StreamEater(process.getInputStream());
StreamEater errorEater = new StreamEater(process.getErrorStream());
this.returnCode = process.waitFor();
outputEater.join();
this.stdOut = outputEater.getContents();
errorEater.join();
this.stdErr = errorEater.getContents();
} catch (IOException e) {
throw new ProcessException("Exception when handling sub-process:",
e);
} catch (InterruptedException e) {
throw new ProcessException("Exception when handling sub-process:",
e);
}
} |
import { Controller, Get, Put, Delete, Param, ParseIntPipe, Body, NotFoundException, Post } from '@nestjs/common';
import { UnidadProducService } from 'src/service/unidad-produc/unidad-produc.service';
import { UnidadProducto } from 'src/modules/unidad-produc/unidad-produc.entity';
@Controller('unidad-produc')
export class UnidadProducController {
constructor(private service:UnidadProducService){}
@Get('/unidadproductos')
async getUnidadProductos( ): Promise<UnidadProducto[]>{
const unidadproductos = await this.service.getUnidadProductos();
return unidadproductos;
}
@Get('/:id')
async getUnidadProducto(@Param('id', ParseIntPipe) id: number): Promise<UnidadProducto>{
const unidadproducto = await this.service.getUnidadProducto( id);
return unidadproducto;
}
@Post('/create')
async createUnidadProducto(@Body() unidadproducto: UnidadProducto):Promise<UnidadProducto>{
const createdUnidadProducto = await this.service.createUnidadProducto(unidadproducto);
return createdUnidadProducto;
}
@Delete('/:id')
async deleteunidadproducto(@Param('id', ParseIntPipe) id: number): Promise<void>{
const unidadproductodelete = await this.service.deleteUnidadProducto(id);
if(!unidadproductodelete) throw new NotFoundException('No hay registro con ese id para eliminar');
return unidadproductodelete;
}
@Put('/:id')
async updateunidadproducto(@Param('id', ParseIntPipe) id: number , @Body() unidadproducto: UnidadProducto): Promise<UnidadProducto>{
const updateunidadproducto = await this.service.updateUnidadProducto(id, unidadproducto);
return updateunidadproducto;
}
}
|
// Persistent converts a Kubernetes CRD object into its internal
// storage.BackendPersistent equivalent
func (in *TridentBackend) Persistent() (*storage.BackendPersistent, error) {
persistent := &storage.BackendPersistent{
Name: in.BackendName,
BackendUUID: in.BackendUUID,
Version: in.Version,
Online: in.Online,
State: storage.BackendState(in.State),
}
return persistent, json.Unmarshal(in.Config.Raw, &persistent.Config)
} |
<filename>taskmanager/src/main/java/pl/tommmannson/taskqueue/utils/NetworkChecker.java
package pl.tommmannson.taskqueue.utils;
import android.Manifest;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.support.annotation.RequiresPermission;
/**
* Created by tomasz.krol on 2015-11-16.
*/
public class NetworkChecker {
@RequiresPermission(Manifest.permission.ACCESS_NETWORK_STATE)
public static boolean hasNetworkConnection(Context context) {
ConnectivityManager manager =
(ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo activeNetworkInfo = manager.getActiveNetworkInfo();
return activeNetworkInfo != null && activeNetworkInfo.isConnected();
}
}
|
def testOperations(self):
self.assertEqual('I', CINS_STR)
self.assertEqual('D', CDEL_STR)
self.assertEqual('M', CMATCH_STR)
self.assertEqual('=', CEQUAL_STR)
self.assertEqual('X', CDIFF_STR) |
Petalburg City
OK I think we’re ready to try again. Place the beacon on the PC like last time.
- There’s still only two and they’ve been youthified also, one even devolved!
Hmm, it must have something to do with the temporal flux the tech guys were talking about. Odd how it didn’t effect you, maybe because we used a different method to get you there… Do you feel different at all?
- No, other than seeing my best friend die yesterday I’m just fine!
I do a quick check anyway, everything feels intact. My leg still doesn’t feel right since the freeze ray incident in Unova. There are still some red marks on my wrist from when I tried to take off the mega bracer.
- Wait a sec, my keystone is missing! The bracer’s still stuck on my wrist but the stone setting is empty!
That’s to be expected, keystones are bound to their native timeline. In other words they can’t travel through time, yours must’ve been left behind when you came here.
- Oh, well it’s not like I desperately need to use mega evolution. I did just fine without it before.
Some timelines don’t even have keystones. The amount and variety of mega stones seem to vary between timelines too.
- So where do I go now?
We’re picking up strange readings all around you but the strongest at the moment seem to be coming from the northwest. You’re in Petalburg City right now so my guess would be to head for the Petalburg Forest.
Route 104
En route to the forest I start training Clara and Ivanova, it didn’t feel completely right pitting them against trainers so soon but they pulled through with Logan and Susan’s help.
I notice Mr. Briney’s house is still there, his boat moored up at the jetty nearby. No sign of Mr. Briney himself or his wingull.
Petalburg Forest
There are still plenty of bugs around. Nothing seems out of the ordinary or out of place, except for the scientist wandering around in the middle of the forest.
Oh, hey there! You’re a trainer right? Have you seen any Shroomish around? I love Shroomish!
- I saw a couple on my way in, yeah.
I’ve been waiting so long to ambush you, dorkly, I got bored. Now had over that Devon gizmo!
- What the hell?! Plasm People?!
Get out of my way or face the wrath of Team Plasma!
Help!
- Just like old times…
I crack my knuckles and with a grin on my face I stand in the plasm grunt’s way.
You asked for it! Go Pooch-
Before he can throw his pokéball I punch him square on the nose. Blood starts to trickle down his lip.
Ow! Hey! That’s not how you’re supposed to-
I give him a mighty thump to the gut. As the plasm grunt collapses to the floor winded, I continue onwards. The scientist from Devon follows me.
I hope you don’t mind if I hang around with you until we get to Rustboro. Is that OK with you?
Ugh… just wait until the Captain hears about this…
- Sure, whatever.
Route 104
The forest eventually opens up, revealing the northern half of route 104. I take the opportunity to grab some oran berries from a nearby plot of berry bushes. I make my way across the wooden bridge, I’m challenged to a double battle by some kids but Logan and Clara make short work of their grass types.
Ah, home sweet home! Thanks for helping me out of a jam, come meet me at Devon HQ. It’s the big tall building, you can’t miss it!
You can still vote for the pokémon to appear next in the PC! Right here! |
#include <stdio.h>
#include <stdlib.h>
int main4()
{
int x1[10] = {0,1,2,3,4,5,6,7,8,9};
int x2[10] = {0,1,2,3,4,5,6,7,8,9};
for(int i=0;i<10;i++){
for(int n=0;n<10;n++){
printf("%d x %d = %d \n",x1[i],x2[n],(x1[i]*x2[n]));
}
}
return 0;
}
|
"""
A model worker that executes the model based on vLLM.
See documentations at docs/vllm_integration.md
"""
import argparse
import asyncio
import json
from typing import List
from fastapi import FastAPI, Request, BackgroundTasks
from fastapi.responses import StreamingResponse, JSONResponse
import torch
import uvicorn
from vllm import AsyncLLMEngine
from vllm.engine.arg_utils import AsyncEngineArgs
from vllm.sampling_params import SamplingParams
from vllm.utils import random_uuid
from fastchat.serve.model_worker import (
BaseModelWorker,
logger,
worker_id,
)
from fastchat.utils import get_context_length
app = FastAPI()
class VLLMWorker(BaseModelWorker):
def __init__(
self,
controller_addr: str,
worker_addr: str,
worker_id: str,
model_path: str,
model_names: List[str],
limit_worker_concurrency: int,
no_register: bool,
llm_engine: AsyncLLMEngine,
):
super().__init__(
controller_addr,
worker_addr,
worker_id,
model_path,
model_names,
limit_worker_concurrency,
)
logger.info(
f"Loading the model {self.model_names} on worker {worker_id}, worker type: vLLM worker..."
)
self.tokenizer = llm_engine.engine.tokenizer
self.context_len = get_context_length(llm_engine.engine.model_config.hf_config)
if not no_register:
self.init_heart_beat()
async def generate_stream(self, params):
self.call_ct += 1
context = params.pop("prompt")
request_id = params.pop("request_id")
temperature = float(params.get("temperature", 1.0))
top_p = float(params.get("top_p", 1.0))
max_new_tokens = params.get("max_new_tokens", 256)
stop_str = params.get("stop", None)
stop_token_ids = params.get("stop_token_ids", None) or []
stop_token_ids.append(self.tokenizer.eos_token_id)
echo = params.get("echo", True)
# Handle stop_str
if isinstance(stop_str, str) and stop_str != "":
stop = [stop_str]
elif isinstance(stop_str, list) and stop_str != []:
stop = stop_str
else:
stop = []
for tid in stop_token_ids:
stop.append(self.tokenizer.decode(tid))
# make sampling params in vllm
top_p = max(top_p, 1e-5)
if temperature <= 1e-5:
top_p = 1.0
sampling_params = SamplingParams(
n=1,
temperature=temperature,
top_p=top_p,
use_beam_search=False,
stop=stop,
max_tokens=max_new_tokens,
)
results_generator = engine.generate(context, sampling_params, request_id)
async for request_output in results_generator:
prompt = request_output.prompt
if echo:
text_outputs = [
prompt + output.text for output in request_output.outputs
]
else:
text_outputs = [output.text for output in request_output.outputs]
text_outputs = " ".join(text_outputs)
# Note: usage is not supported yet
ret = {"text": text_outputs, "error_code": 0, "usage": {}}
yield (json.dumps(ret) + "\0").encode()
async def generate(self, params):
async for x in self.generate_stream(params):
pass
return json.loads(x[:-1].decode())
def release_worker_semaphore():
worker.semaphore.release()
def acquire_worker_semaphore():
if worker.semaphore is None:
worker.semaphore = asyncio.Semaphore(worker.limit_worker_concurrency)
return worker.semaphore.acquire()
def create_background_tasks(request_id):
async def abort_request() -> None:
await engine.abort(request_id)
background_tasks = BackgroundTasks()
background_tasks.add_task(release_worker_semaphore)
background_tasks.add_task(abort_request)
return background_tasks
@app.post("/worker_generate_stream")
async def api_generate_stream(request: Request):
params = await request.json()
await acquire_worker_semaphore()
request_id = random_uuid()
params["request_id"] = request_id
generator = worker.generate_stream(params)
background_tasks = create_background_tasks(request_id)
return StreamingResponse(generator, background=background_tasks)
@app.post("/worker_generate")
async def api_generate(request: Request):
params = await request.json()
await acquire_worker_semaphore()
request_id = random_uuid()
params["request_id"] = request_id
output = await worker.generate(params)
release_worker_semaphore()
await engine.abort(request_id)
return JSONResponse(output)
@app.post("/worker_get_status")
async def api_get_status(request: Request):
return worker.get_status()
@app.post("/count_token")
async def api_count_token(request: Request):
params = await request.json()
return worker.count_token(params)
@app.post("/worker_get_conv_template")
async def api_get_conv(request: Request):
return worker.get_conv_template()
@app.post("/model_details")
async def api_model_details(request: Request):
return {"context_length": worker.context_len}
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--host", type=str, default="localhost")
parser.add_argument("--port", type=int, default=21002)
parser.add_argument("--worker-address", type=str, default="http://localhost:21002")
parser.add_argument(
"--controller-address", type=str, default="http://localhost:21001"
)
parser.add_argument("--model-path", type=str, default="lmsys/vicuna-7b-v1.3")
parser.add_argument(
"--model-names",
type=lambda s: s.split(","),
help="Optional display comma separated names",
)
parser.add_argument("--limit-worker-concurrency", type=int, default=1024)
parser.add_argument("--no-register", action="store_true")
parser.add_argument("--num-gpus", type=int, default=1)
parser = AsyncEngineArgs.add_cli_args(parser)
args = parser.parse_args()
if args.model_path:
args.model = args.model_path
if args.num_gpus > 1:
args.tensor_parallel_size = args.num_gpus
engine_args = AsyncEngineArgs.from_cli_args(args)
engine = AsyncLLMEngine.from_engine_args(engine_args)
worker = VLLMWorker(
args.controller_address,
args.worker_address,
worker_id,
args.model_path,
args.model_names,
args.limit_worker_concurrency,
args.no_register,
engine,
)
uvicorn.run(app, host=args.host, port=args.port, log_level="info")
|
"""
OnModified Function
"""
import os
import boto3
import requests
from aws_lambda_powertools.tracing import Tracer # pylint: disable=import-error
from aws_lambda_powertools.logging.logger import Logger # pylint: disable=import-error
API_URL = os.environ["API_URL"]
ENVIRONMENT = os.environ["ENVIRONMENT"]
TABLE_NAME = os.environ["TABLE_NAME"]
dynamodb = boto3.resource("dynamodb") # pylint: disable=invalid-name
table = dynamodb.Table(TABLE_NAME) # pylint: disable=invalid-name,no-member
logger = Logger() # pylint: disable=invalid-name
tracer = Tracer() # pylint: disable=invalid-name
@tracer.capture_method
def get_payment_token(order_id: str) -> str:
"""
Retrieve the paymentToken from DynamoDB
"""
response = table.get_item(Key={
"orderId": order_id
})
return response["Item"]["paymentToken"]
@tracer.capture_method
def update_payment_amount(payment_token: str, amount: int) -> None:
"""
Update the payment amount
"""
response = requests.post(API_URL+"/updateAmount", json={
"paymentToken": payment_token,
"amount": amount
})
body = response.json()
if "message" in body:
raise Exception("Error updating amount: {}".format(body["message"]))
@logger.inject_lambda_context
@tracer.capture_lambda_handler
def handler(event, _):
"""
Lambda handler
"""
order_id = event["detail"]["new"]["orderId"]
total = event["detail"]["new"]["total"]
logger.info({
"message": "Received completed order {}".format(order_id),
"orderId": order_id
})
payment_token = get_payment_token(order_id)
update_payment_amount(payment_token, total)
|
def v3_to_v1_run_query_req(self, v3_req):
v1_req = googledatastore.RunQueryRequest()
v1_partition_id = v1_req.partition_id
v1_partition_id.project_id = v3_req.app
if v3_req.name_space:
v1_partition_id.namespace = v3_req.name_space
if v3_req.HasField('transaction'):
v1_req.read_options.transaction = self._v3_to_v1_txn(v3_req.transaction)
elif v3_req.strong:
v1_req.read_options.read_consistency = (
googledatastore.ReadOptions.STRONG)
elif v3_req.HasField('strong'):
v1_req.read_options.read_consistency = (
googledatastore.ReadOptions.EVENTUAL)
self._query_converter.v3_to_v1_query(v3_req, v1_req.query)
return v1_req |
package org.camunda.bpm.getstarted.pizza.uimediator;
import java.io.Serializable;
import java.util.List;
import java.util.logging.Logger;
import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.inject.Named;
import org.camunda.bpm.engine.FormService;
import org.camunda.bpm.engine.TaskService;
import org.camunda.bpm.engine.task.Task;
@RequestScoped
@Named("uiMediator")
public class UIMediator implements Serializable {
private static final long serialVersionUID = -5296361038666702228L;
private final static Logger LOGGER = Logger.getLogger("PIZZA-ORDERS");
@Inject
private TaskService taskService;
@Inject
private FormService formService;
private String nextTaskId;
private String nextTaskForm;
/**
* check for new task in same process for same user
*/
public void checkProcessInstanceStatus(String assignee, String processInstanceId) {
nextTaskId = null;
nextTaskForm = null;
if (processInstanceId != null && assignee != null) {
List<Task> tasks = taskService.createTaskQuery().taskAssignee(assignee).processInstanceId(processInstanceId)
.list();
if (tasks.size() == 1) {
nextTaskId = tasks.get(0).getId();
nextTaskForm = formService.getTaskFormData(nextTaskId).getFormKey().replaceAll("app:", "")
.replaceAll(".jsf", "");
}
}
// possible extension here: wait a couple of (milli)seconds to check if that
// task is reached asynchronously if you have this requirement
// Possible addition: wait for a defined time if something pops up.
if (nextTaskForm != null) {
LOGGER.info("\n\n\nMediator decided to route to task form " + nextTaskForm+"\n\n\n");
} else {
LOGGER.info("\n\n\nMediator decided to route back to task list, no user task coming in navigation flow.\n\n\n");
}
}
public String getNextTaskId() {
return nextTaskId;
}
public String getNextTaskForm() {
return nextTaskForm;
}
} |
<filename>test.c
#include "third_party/test.h"
#include "buchstabensuppe.h"
#include <errno.h>
#define FAMILY_EMOJI "👩👩👧👦"
int main(void) {
bs_utf32_buffer_t family = bs_decode_utf8(FAMILY_EMOJI, sizeof(FAMILY_EMOJI) - 1);
test_case("No errors in decode", errno == 0);
bool family_decoded_correctly =
family.bs_utf32_buffer_len == 7 &&
family.bs_utf32_buffer[0] == 128105 &&
family.bs_utf32_buffer[1] == 8205 &&
family.bs_utf32_buffer[2] == 128105 &&
family.bs_utf32_buffer[3] == 8205 &&
family.bs_utf32_buffer[4] == 128103 &&
family.bs_utf32_buffer[5] == 8205 &&
family.bs_utf32_buffer[6] == 128102;
test_case("Family emoji is decoded correctly", family_decoded_correctly);
bs_utf32_buffer_free(&family);
test_case("Freed buffer has no capacity", family.bs_utf32_buffer_cap == 0 &&
family.bs_utf32_buffer_len == 0);
FILE *random = fopen("/dev/urandom", "rb");
if(random != NULL) {
char buf[1024];
size_t read = fread(buf, 1, sizeof(buf), random);
if(!ferror(random) && read == sizeof(buf)) {
errno = 0;
bs_utf32_buffer_t unlikely = bs_decode_utf8(buf, sizeof(buf));
test_case("Utf8-decoding random stuff failed", errno == EINVAL);
bs_utf32_buffer_free(&unlikely);
}
}
}
|
/* Helped function to put duplicate sequence in the same tree. */
static int need_add_seq_dup(Sequence *seq)
{
Sequence *p;
if ((!seq->strip) || (!seq->strip->stripdata)) {
return 1;
}
p = seq->prev;
while (p) {
if ((!p->strip) || (!p->strip->stripdata)) {
p = p->prev;
continue;
}
if (STREQ(p->strip->stripdata->name, seq->strip->stripdata->name)) {
return 2;
}
p = p->prev;
}
p = seq->next;
while (p) {
if ((!p->strip) || (!p->strip->stripdata)) {
p = p->next;
continue;
}
if (STREQ(p->strip->stripdata->name, seq->strip->stripdata->name)) {
return 0;
}
p = p->next;
}
return (1);
} |
Load flow problem formulation as a holomorphic embedding method
This paper presents the description and results of the computational implementation of the Holomorphic Embedding Load Flow Method (HELM) basic formulation. The approach is a non-iterative, but recursive technique proposed as an alternative method for solving the traditional power flow problem (PFP). The main task of the method is the computation of power series coefficients which are used to generate rational function obtained from Padé approximants. These approximants are employed to determine the PFP solution. The basic computational implementation of the method is carried out by exploiting the same input/output data structure of the well-known MATPOWER software. This software is an open source tool developed in Matlab and so adequate for implementation of new contributions related to the PFP. Experiments and results for eight power systems demonstrate the efficacy of the proposed PFP tool, when compared with the Newton-Raphson method. |
def dockerfile_abspath(self):
if self.buildable():
return os.path.join(self.repo_d.abspath(),
self.path, self.dockerfile)
else:
return None |
QPR had two strong penalty appeals turned down by referee Craig Pawson
QPR director of football Les Ferdinand has been been charged by the Football Association after allegedly abusing a match official following his side's 2-1 home defeat to Tottenham.
The FA said it is alleged Ferdinand "used abusive and/or insulting words and/or behaviour towards a match official in or around the tunnel area."
QPR had two strong penalty claims turned down by referee Craig Pawson.
The ex-Hoops striker has until 18:00 GMT on 13 March to respond.
Media playback is not supported on this device Big calls cost us - Ramsey
QPR remain without a win at home under head coach Chris Ramsey, who was appointed to replace Harry Redknapp on 13 February.
The QPR boss was said he was "very disappointed" with the defeat by Spurs which kept his side three points adrift of safety.
After the game Ramsey complained about two penalty appeals - one of which was when Mauricio Isla went down under a challenge from Tottenham goalkeeper Hugo Lloris, and in a separate incident Spurs midfielder Nabil Bentaleb appeared to block Charlie Austin's shot on goal with his hands.
Ramsey told BBC's Match of the Day: "We thought we deserved at least a point from the game, [there were] two controversial incidents that we need clarification on.
"We're going to need to take a look at those and we hope they don't cost us at the end of the season. We realise the referees have a difficult job and sometimes they go against you." |
Coarse grained variables and deterministic chaos in an excitable system.
Temporal coarse graining was applied to the dynamical variables of a semiconductor laser with optical feedback. The chaotic low frequency fluctuations obtained in numerical and experimental data are shown to have properties of a self-excitable deterministic system. External exciting noise is replaced by the ultrafast chaotic oscillations of the system. A low dimensional coarse-grained phase space is defined and time constants are introduced and measured for the exponential drop and recovery of the randomly excited equally shaped spikes. |
/** The base class for delayed shader loaders.
* @see Long description of src/graphics/shader_loader.hxx
*/
class ShaderDelayLoader {
protected:
bool isLoaded;
ShaderDelayLoader()
: isLoaded(false)
{ }
public:
virtual const Shader* operator->() = 0;
void unload() { isLoaded = false; }
} |
s=input()
p=[]
r=[]
if len(s)==1:
print(s,end='')
else:
for i in range(len(s)):
if s[i].isdigit():
p.append(s[i])
q=sorted(p)
q=''.join(q)
for i in range(len(q)):
if q[i].isdigit():
r.append(q[i]+'+')
r=''.join(r)
w=r[0:-1]
print(w,end='')
|
<reponame>Nyufu/Focus
#pragma once
#include <Platform.h>
#include <Platform/WinNTEx.h>
namespace Focus::Memory::Allocator {
template <class _Ty>
struct Heap {
public:
static_assert(!STD is_const_v<_Ty>, "The C++ Standard forbids containers of const elements "
"because Heap<const T> is ill-formed.");
static_assert(alignof(_Ty) <= platform::default_align, "The Heap allocator can't allocate memory for overaligned types.");
using _From_primary = Heap;
using value_type = _Ty;
using size_type = size_t;
using difference_type = ptrdiff_t;
using propagate_on_container_move_assignment = STD true_type;
using is_always_equal = STD true_type;
constexpr Heap() noexcept {}
constexpr Heap(const Heap&) noexcept = default;
template <class _Other>
constexpr Heap(const Heap<_Other>&) noexcept {}
void deallocate(_Ty* const ptr, [[maybe_unused]] const size_t count) noexcept {
if constexpr (config::debug)
::operator delete (ptr, sizeof(_Ty) * count, STD align_val_t{ platform::default_align });
else
::HeapFree(GetProcessHeap_(), 0Ul, ptr);
}
[[nodiscard]] __declspec(allocator) _Ty* allocate(_CRT_GUARDOVERFLOW const size_t count) noexcept {
if constexpr (config::debug)
return static_cast<_Ty*>(::operator new(sizeof(_Ty) * count, STD align_val_t{ platform::default_align }, STD nothrow));
else
return static_cast<_Ty*>(::HeapAlloc(GetProcessHeap_(), 0Ul, sizeof(_Ty) * count));
}
};
template <class _Ty, class _Other>
[[nodiscard]] bool operator==(const Heap<_Ty>&, const Heap<_Other>&) noexcept {
return true;
}
template <class _Ty, class _Other>
[[nodiscard]] bool operator!=(const Heap<_Ty>&, const Heap<_Other>&) noexcept {
return false;
}
} |
def gff_seq_extract(gff, fa):
with open(gff, "r") as gff_in, open(fa, "w") as fa_out:
for line in gff_in:
seq_ok, id_ok = False, False
fields = line.split("\t")
if fields[2] == "CDS" and not fields[0].startswith("#>"):
desc = fields[-1].split(";")
for attr in desc:
if re.search("protein_id=", attr):
prot_id = attr.split("=")[1]
id_ok = True
elif re.search("translation=", attr):
seq = attr.split("=")[1]
seq_ok = True
if seq_ok and id_ok:
header = ">" + fields[0] + "|" + prot_id
fa_out.writelines([header + "\n", seq]) |
<gh_stars>1-10
package generator
type IdDetail struct {
timestamp uint64
workid uint64
seq uint64
}
type NextId interface {
GetNextId() int64
}
type ParseId interface {
ParseId() *IdDetail
}
|
WESTERN MISANDRY: http://www.dauntseys.org/resource.aspx?id=47305
MISANDRY: WHAT IS IT?: http://exposingfeminism.wordpress.com/what-is-misandry/
SCUM Manifesto: http://www.womynkind.org/scum.htm
Let me get you some quotes from this, just for reference:
MILD TRIGGER WARNING!!!!
“The male is a biological accident: the Y (male) gene is an incomplete X (female) gene, that is, it has an incomplete set of chromosomes. In other words, the male is an incomplete female, a walking abortion, aborted at the gene stage.”
“The male is completely egocentric, trapped inside himself, incapable of empathizing or identifying with others, or love, friendship, affection of tenderness.”
“To call a man an animal is to flatter him; he’s a machine, a walking dildo.”
“Every man, deep down, knows he’s a worthless piece of shit. Overwhelmed by a sense of animalism and deeply ashamed of it;”
“Being totally sexual, incapable of cerebral or aesthetic responses, totally materialistic and greedy, the male, besides inflicting on the world `Great Art’, has decorated his unlandscaped cities with ugly buildings (both inside and out), ugly decors, billboards, highways, cars, garbage trucks, and, most notably, his own putrid self.”
“The males like death — it excites him sexually and, already dead inside, he wants to die.” |
// BoolEnv allows you to pull out a var as bool
func (h *Helpers) BoolEnv(s string) bool {
s = strings.ToUpper(s)
if v, ok := os.LookupEnv(s); ok {
obool, err := strconv.ParseBool(v)
if err != nil {
logrus.Errorln(err)
return false
}
return obool
}
return false
} |
<filename>src/main/java/com/autuan/project/front/controller/GroupFrontController.java
package com.autuan.project.front.controller;
import com.autuan.project.front.entity.*;
import com.autuan.project.promote.group.service.IGroupCustomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @className: GroupFrontController
* @author: sen.zhou
* @description:
* @date: 2020/7/4 11:42
* @version: V2.0.0
* @company:上海奥若拉信息科技集团有限公司
**/
@RestController
@RequestMapping("/front/group")
public class GroupFrontController {
@Autowired
private IGroupCustomService groupCustomService;
@RequestMapping("/groupData")
public ReturnResult groupData(@RequestBody GroupDataReq req) {
List<GroupDataRes> res = groupCustomService.groupData(req);
return ReturnResult.ok(res);
}
/***
* 查询会员是否有资格查看小组数据
* @param req
* @throws Throwable
* @description:
* @author: sen.zhou
* @return : com.autuan.project.front.entity.ReturnResult
* @since: 17:45 2020/7/12
*/
@RequestMapping("/groupDataPower")
public ReturnResult groupDataPower(@RequestBody GroupDataReq req) {
boolean bool = groupCustomService.groupDataPower(req);
return ReturnResult.ok(bool);
}
} |
<reponame>lucho1/AGPEngine<filename>Source/Core/Utils/FileStringUtils.h<gh_stars>0
#ifndef _FILESTRINGUTILS_H_
#define _FILESTRINGUTILS_H_
#include "../Globals.h"
namespace FileUtils
{
// --- File Standard Functions ---
std::string MakePath(const std::string& dir, const std::string& filename);
std::string GetDirectory(const std::string& path);
// Last time file was modified. Check for file modifications for hot reloads.
uint64 GetFileLastWriteTimestamp(const char* filepath);
// --- Files Dialogues ---
class FileDialogs
{
public:
// If cancelled, returns empty string
static std::string OpenFile(const char* filter);
// If cancelled, returns empty string
static std::string SaveFile(const char* filter, const char* filename);
};
}
#endif //_FILESTRINGUTILS_H_ |
def _rollback_live_migration(self, context, instance_ref,
dest, block_migration):
host = instance_ref['host']
self._instance_update(context,
instance_ref['uuid'],
host=host,
vm_state=vm_states.ACTIVE,
task_state=None,
expected_task_state=task_states.MIGRATING)
self.network_api.setup_networks_on_host(context, instance_ref,
self.host)
for bdm in self._get_instance_volume_bdms(context,
instance_ref['uuid']):
volume_id = bdm['volume_id']
volume = self.volume_api.get(context, volume_id)
self.compute_rpcapi.remove_volume_connection(context, instance_ref,
volume['id'], dest)
if block_migration:
self.compute_rpcapi.rollback_live_migration_at_destination(context,
instance_ref, dest) |
def _calc_self_term(self):
values = -self.a/self.sqrt_pi*self.q_squared
eself = np.sum(values)
return eself |
/*
Copyright 2022 The Kruise Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package util
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
)
func HasOwnerRef(target, owner metav1.Object) bool {
ownerUID := owner.GetUID()
for _, ownerRef := range target.GetOwnerReferences() {
if ownerRef.UID == ownerUID {
return true
}
}
return false
}
func RemoveOwnerRef(target, owner metav1.Object) bool {
if !HasOwnerRef(target, owner) {
return false
}
ownerUID := owner.GetUID()
oldRefs := target.GetOwnerReferences()
newRefs := make([]metav1.OwnerReference, len(oldRefs)-1)
skip := 0
for i := range oldRefs {
if oldRefs[i].UID == ownerUID {
skip = -1
} else {
newRefs[i+skip] = oldRefs[i]
}
}
target.SetOwnerReferences(newRefs)
return true
}
func SetOwnerRef(target, owner metav1.Object, gvk schema.GroupVersionKind) bool {
if HasOwnerRef(target, owner) {
return false
}
ownerRefs := append(
target.GetOwnerReferences(),
*metav1.NewControllerRef(owner, gvk),
)
target.SetOwnerReferences(ownerRefs)
return true
}
|
/**
* Attempts to deserialize a primitive.
* If the requested type is not a primitive, or the types don't line up, returns null.
*/
@Nullable
private final Object tryDeserializePrimitive (final Class<?> requestedType, final JsonElement element) {
if (requestedType.isPrimitive() || requestedType == String.class || Number.class
.isAssignableFrom(requestedType)) {
if (element.isJsonPrimitive()) {
return deserializePrimitive(requestedType, element);
} else {
Logger.warn("Json value is the wrong type");
}
}
return null;
} |
use std::rt::io::net::ip::{SocketAddr, IpAddr, Ipv4Addr};
use knob::Settings;
pub trait SocketSettings {
fn socket(&self) -> SocketAddr;
fn port(&self) -> u16;
fn ip(&self) -> IpAddr;
}
impl SocketSettings for Settings {
fn socket(&self) -> SocketAddr {
do self.fetch_with("addr") |addr| {
match addr {
Some(socket_addr) => { socket_addr },
None => {
let port: u16 = self.port();
let ip: IpAddr = self.ip();
SocketAddr { ip: ip, port: port }
}
}
}
}
fn port(&self) -> u16 {
self.fetch("port").unwrap_or(8080)
}
fn ip(&self) -> IpAddr {
self.fetch("ip").unwrap_or(Ipv4Addr(127,0,0,1))
}
}
#[cfg(test)]
mod tests {
use super::*;
use knob::Settings;
#[test]
fn test_insert() {
let mut settings = Settings::new();
settings.set("port", "12345");
settings.set("ip", "127.0.0.1");
let socket = settings.socket();
assert_eq!(socket.to_str(), ~"127.0.0.1:12345")
}
} |
/**
* Constructs a scale-space image pyramid. Each layer in the pyramid is the same size as the input image but
* has a different amount of blur applied to it.
*
* @param scaleSpace Amount of blur applied to each layer in the pyramid relative to the input image.
* @param imageType Type of image
* @param <T> Type of image
* @return Scale-space image pyramid
*/
public static <T extends ImageGray<T>>
PyramidFloat<T> scaleSpace( double scaleSpace[], Class<T> imageType ) {
double[] scaleFactors = new double[ scaleSpace.length ];
for( int i = 0; i < scaleSpace.length; i++ ) {
scaleFactors[i] = 1;
}
double[] sigmas = new double[ scaleSpace.length ];
sigmas[0] = scaleSpace[0];
for( int i = 1; i < scaleSpace.length; i++ ) {
double c = scaleSpace[i];
double b = scaleSpace[i-1];
sigmas[i] = Math.sqrt(c*c-b*b);
}
return floatGaussian(scaleFactors,sigmas,imageType);
} |
// initialize all 3 decoders from the stream input.
func (s *sequenceDecs) initialize(br *bitReader, hist *history, literals, out []byte) error {
if err := s.litLengths.init(br); err != nil {
return errors.New("litLengths:" + err.Error())
}
if err := s.offsets.init(br); err != nil {
return errors.New("offsets:" + err.Error())
}
if err := s.matchLengths.init(br); err != nil {
return errors.New("matchLengths:" + err.Error())
}
s.literals = literals
s.hist = hist.b
s.prevOffset = hist.recentOffsets
s.maxBits = s.litLengths.fse.maxBits + s.offsets.fse.maxBits + s.matchLengths.fse.maxBits
s.windowSize = hist.windowSize
s.out = out
return nil
} |
/**
* Identifier for the local repository
*/
public static class LocalRepositoryId implements Id {
private final URL configPath;
private final String workspaceName;
/**
* @param configPathUrl url of configuration file
* @param workspaceName name of workspace
*/
public LocalRepositoryId(final URL configPathUrl, final String workspaceName ) {
this.configPath = configPathUrl;
this.workspaceName = workspaceName;
}
@Override
public URL getConfiguration() {
return configPath;
}
@Override
public String getUrl() {
return this.configPath.toString();
}
@Override
public String getWorkspaceName() {
return this.workspaceName;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((this.configPath == null) ? 0 : this.configPath.hashCode());
result = prime * result + ((this.workspaceName == null) ? 0 : this.workspaceName.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
LocalRepositoryId other = (LocalRepositoryId)obj;
if (this.configPath == null) {
if (other.configPath != null)
return false;
} else if (!this.configPath.equals(other.configPath))
return false;
if (this.workspaceName == null) {
if (other.workspaceName != null)
return false;
} else if (!this.workspaceName.equals(other.workspaceName))
return false;
return true;
}
@Override
public String toString() {
return "LocalRepositoryId [configPath=" + this.configPath + ", workspaceName=" + this.workspaceName + "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
} |
// ConnectAndCloseTestDB returns a db connection with actual DB tables (not temporary)
// that support multiple connection, but that must be closed.
func ConnectAndCloseTestDB(t *testing.T, eventsTable, cursorTable string) (*sql.DB, func()) {
dbc, err := connect(10)
require.NoError(t, err)
maybeDrop := func() {
if eventsTable != "" {
_, err := dbc.Exec(fmt.Sprintf(drop, eventsTable))
require.NoError(t, err)
}
if cursorTable != "" {
_, err := dbc.Exec(fmt.Sprintf(drop, cursorTable))
require.NoError(t, err)
}
}
maybeDrop()
createEventsTable(t, dbc, eventsTable, false)
createCursorsTable(t, dbc, cursorTable, false)
return dbc, func() {
maybeDrop()
require.NoError(t, dbc.Close())
}
} |
Last week, Paweł Głowacki passed away. A few words, probably incoherent, as I’m still flabbergasted by the news.
Originally from Poland he had moved to The Netherlands in 2001 (causing his son Mateusz to be far more fluent in Dutch than his dad) while starting to work for Borland, doing the full ride through CodeGear and Embarcadero to Idera as one of their enthousiastic Delphi evangelists.
Having already gone through a rough year myself, it took me some time to sit down and reflect a bit on his sudden passing away.
Most of the information around his passing has been on Facebook.
My current state of mind needs me to jot a few things down, and since Facebook keeps redacting away the information I really want to see (probably a chicken and egg problem, as it also insists showing me stuff I do NOT want to see, causing me to hardly look at Facebook any more, and likely having worsened the issue), below are some links and a screenshot.
Though we didn’t see each other much over the last few years, meeting up was always fun, especially talking about old shared activities (one project, don’t ask, many presentations on conferences and sessions) and his hobbies (for instance diving).
I found out about the latter by sheer coincidence. I’ve a mentally retarded brother for which I’m the curator ad litem. In practice this means not just legal guardian, but also coaching my brother with many events. About 15 years ago, over several years, my brother has stepped up from swimming via snorkeling to shallow water diving (always under supervision of a certified diving instructor).
About once a year, my brothers diving group goes to open water where I suddenly bumped into Paweł of which I knew he did sports (and music: he’s an excellent guitar player) but not exactly which ones.
Some of the coolest Delphi related events we did or attended together were the product launches for the BeNeLux in the early 2010s, ItDevCon conferences in Italy, SDN presentations in The Netherlands and EKON visits in Germany.
Knowing more of each others non-Delphi side, we had much more to talk about. So we mixed conversations about free time and Delphi topics enjoying an occasional drink or two.
I will remember those times. R.I.P. Paweł. All the best to his wife Barbara, son Mateusz, other family members, friends and colleagues.
This is the im memorian that Barnsten – the Benelux reseller for Embarcadero that organised a lot of the events:
This picture is taken in May this year at the Accelerate Your Development event in Bussum by Danny Wind.
In Memoriam – Pawel Glowacki It is with great sadness that we have to inform you about the sudden loss of Pawel Glowacki. He was only 47 years old. Pawel was employed by Embarcadero as Technical Lead but worked very closely with the Barnsten team because he lived in Amsterdam. Pawel has had great influence on all the Barnsten events and webinars. He always knew flawlessly what was going on in the development tools market. Many new themes and programs have arisen from consultation with him. Most of you have been in direct or indirect contact with him at the live events or via his webinars, books, blogs, white papers etc. His optimism, technical knowledge and positive attitude to life left a deep impression, but also a great emptiness at the loss of such a unique individual. Pawel will be buried this Friday in his homeland Poland. On behalf of the Barnsten team, Raymond Horsten
Director
–jeroen
PS:
https://www.facebook.com/whitewaterflow/posts/10159676988305425
Z głębokim żalem zawiadamiamy, że 13 grudnia 2017 odszedł nasz ukochany Paweł. Pożegnamy Go 22 grudnia w Katowicach o godzinie 13 w Bazylice Ojców Franciszkanów, ul. Panewnicka 76, Katowice-Panewniki.
Basia, Mateusz, Ewa, Rodzice i TeściowaDeeply sad we have to inform that on December 13, 2017 our beloved Paweł passed away. We will say good bye to Him on December 22, 2017 in Katowice at 1 pm in Bazylika Ojców Franciszkanów, ul. Panewnicka 76, Katowice-Panewniki, Poland.
Basia, Mateusz, Ewa, Parents and Mother in law
https://www.facebook.com/whitewaterflow/posts/10159676988305425 Z głębokim żalem zawiadamiamy, że 13 grudnia 2017 odszedł nasz ukochany Paweł. Pożegnamy Go 22 grudnia w Katowicach o godzinie 13 w Bazylice Ojców Franciszkanów, ul. Panewnicka 76, Katowice-Panewniki. Basia, Mateusz, Ewa, Rodzice i TeściowaDeeply sad we have to inform that on December 13, 2017 our beloved Paweł passed away. We will say good bye to Him on December 22, 2017 in Katowice at 1 pm in Bazylika Ojców Franciszkanów, ul. Panewnicka 76, Katowice-Panewniki, Poland. Basia, Mateusz, Ewa, Parents and Mother in law [Archive.is] https://www.facebook.com/whitewaterflow – his timeline
Source:
Via:
Goodbye, @pglowack. You’ll be missed. Very sad moment. Loosing a friend and a very active member of the community: https://t.co/btCwktcBeY — MarcoCantu (@marcocantu) December 18, 2017 |
For the VOY episode of the same name, please see " Tuvix ".
"I am Lieutenant Tuvok. And I'm Neelix."
Tuvix was a hybrid being created as the result of a transporter accident on the USS Voyager, combining Lieutenant Tuvok, Neelix, their uniforms, and an orchid in 2372.
Contents show]
Origin Edit
The accident was the conclusion to an away mission to collect some orchid samples. Only one molecular pattern rematerialized, and formed a healthy organism combining everything regarding Tuvok and Neelix, including organs, enzymes, and memories. According to The Doctor, Tuvix also possessed: "…Tuvok's sense of intellectual superiority, and Neelix's annoying ebullience." Despite repairs having just been made to the transporter, no fault could be found in the logs at the time of the accident.
It was Tuvix, the name the combined individual had given himself, who realized what had happened. The plant samples, which were also caught up in the matter stream and were also a part of Tuvix, contained lysosomal enzymes. Tuvix's research indicated that this could be an indicator of symbiogenesis, where an organism reproduces by merging with a second species to produce a hybrid. This usually only occurs with microcellular organisms. Tuvix suggested that being deconstructed during beaming allowed the symbiogenesis enzymes of the plant to react to Neelix's and Tuvok's DNA in the matter stream, so only the single organism existed at the point of rematerialization. The theory turned out to be correct when two plants and the orchid were beamed up together, resulting in one plant arriving on Voyager. (VOY: "Tuvix")
Life on Voyager Edit
The Doctor told Tuvix that it might be many years before he could find a way to separate them – in the meantime, Tuvix was invited to become a member of the crew, and given the rank of Lieutenant.
Captain Janeway noted in her captain's log that Tuvix managed to gain friends among the crew in his own right, and was a very able tactical officer who wasn't afraid to voice his opinion. She also noted that Tuvix was an able advisor who cleverly used humor to make a point, and his food was better than Neelix's. He was keeping a respectful distance from Kes, who was mourning the loss of two friends, and feeling uncomfortable with the reminder of them walking around. Tom Paris joked, after Chakotay lost at pool twice against Tuvix, "We've created a monster!"
It took The Doctor almost a month, but he found a way to reverse the accident, by using a radioactive isotope which would attach to the DNA strands of one of the merged species, but not the other. By beaming out the segregated DNA strands, the transporter would have the original DNA strands necessary to restore the two individuals.
Tuvix announced that he didn't want to die, feeling that he had just as much right to exist as any other being. He explained to Janeway that, while he did care about Tuvok and Neelix (regarding them as his 'parents'), this also gave him the will to live of two men, and he didn't want to die. He pleaded with Kes, among others, to speak to the captain on his behalf. Kes persuaded Janeway, however, that the procedure was necessary, as she needed Tuvok and Neelix. Tuvix pleaded with the bridge crew to stop the captain from murdering him, but eventually allowed the procedure to take place, saying that everyone would have to live with his death on their conscience, for which he was sorry, as they were all, in his eyes, good people; his friends.
However, The Doctor refused to perform the procedure; as a physician, he had sworn an oath to do no harm, and he refused to take Tuvix's life, especially against his will. Janeway herself, therefore, performed the process. It was a success, and Tuvok and Neelix were restored, although Janeway was forced to live with the ethical conundrum around the difficult decision. (VOY: "Tuvix")
Legacy Edit
Naomi Wildman later recounted Tuvix's creation to Brax describing it as "Neelix and Commander Tuvok got combined to make a completely different person." While Brax doubted the possibility, Naomi reaffirmed her claim by stating, "You don't think I could make up a story like that, do you?" (VOY: "Homestead")
Memorable quotes Edit
"So, what should I call you?"
"Ah, a name. I hadn't thought of that. What an intriguing question. I can see why The Doctor's finding it so difficult to choose one. A name can have a significant effect upon a person's sense of identity. I've got it."
"What?"
"Why don't you call me Neevok? Wait. This is better. How about Tuvix?"
-Kes and Tuvix
"Do you mind telling me what's going on here, crewman?"
"We're making dinner."
"I see. All right, everybody out!"
"On whose authority?"
"Chief of Security or Head Chef. Take your pick. Out, out, out! Come, come, out."
-Tuvix to Hogan, upon finding him making a mess in the galley.
"It's funny. If something happened to Tuvok, if Neelix were here, he'd be the first person to comfort me. And if I lost Neelix, Tuvok would be the first person to guide me spiritually. Now I don't have either of them."
"You have me, Kes."
"Thank you, but-"
"I remind you of what you've lost."
"It's not your fault."
-Kes and Tuvix
"Commander, are you going to stand by and do nothing while she commits murder? Mister Ayala. Yes, Lieutenant Paris. You. Doesn't anyone see that this is wrong?"
"Let him go."
"Each of you is going to have to live with this, and I'm sorry for that for you are all good, good people. My colleagues, my friends, I forgive you."
"Commander Chakotay, advise The Doctor we're on our way to Sickbay."
-Tuvix protesting his right to live to Janeway
"So at what point did he become an individual and not a transporter accident?"
-Janeway and Chakotay
Appendices Edit
Background information Edit
Tuvix was played by actor Tom Wright in his first of two Star Trek appearances. When he first received a call from his agent about the available role of Tuvix, Wright was immediately eager to take the part. "I felt that it would be unique to create a totally different character," he said, "that had never been created on Star Trek before." (Star Trek Monthly issue 20, p. 58)
Neelix actor Ethan Phillips was originally considered for the role of Tuvix. However, Cliff Bole – who directed the episode entitled "Tuvix" – was glad that this idea was dropped. As he explained, "It was better to get just a little different take on the character. Ethan is so identifiable. He might have had a problem trying to give Tuvix the elements of Tuvok's character." (The Official Star Trek: Voyager Magazine issue 15) Likewise, Tuvok actor Tim Russ was also considered for the part but he himself was ultimately glad this plan didn't go ahead. "I might favour Tuvok," he conceded, "whereas Tom Wright could be more objective." (Star Trek Monthly issue 106, p. 25)
Though he had never seen Star Trek: Voyager before, Wright knew both Ethan Phillips and Tim Russ personally, having often auditioned for the same roles as Russ and previously acted in a play with Phillips. Required to audition for the character of Tuvix, Wright felt his best course of action would be to play a combination of the personalities and styles of those two Voyager cast members. The audition won him the role. Cliff Bole recalled, "I picked him because I had seen a lot of the work he has done." After Wright was cast as Tuvix, the staff of Voyager sent him a few video tapes of past episodes from the series. The actor noted, "From those, I decided which aspects of each character to put into the part." (The Official Star Trek: Voyager Magazine issue 13)
While creating such a composite character, Tom Wright was continually unsure exactly how his performance would end up. This was because the role of Tuvix took Wright into unfamiliar territory. He recalled, "Every now and then a character, situation or work experience forces you outside of your strength, and you have to perform in an area that is a little bit unknown. I did a lot of that in 'Tuvix', so I was completely unsure of how it would turn out. I'm very confident of my ability as an actor, but in this particular circumstance I wasn't sure how it would all pay off." (Star Trek Monthly issue 20, p. 58)
Tom Wright was also aware that he had to make Tuvix a likeable character, to accentuate the importance of the character's "death" at the episode's conclusion. "I knew the character's warmth had to be present at all times," the actor stated, "so that over the course of the show, the rest of the characters would warm up to him. And the reason it becomes so difficult [for Janeway to separate Tuvix at the end] is that they've all grown attached to him. They've all taken a certain amount of delight in this new individual." (The Official Star Trek: Voyager Magazine issue 13)
Though the intention was for there to be a moral dilemma in Tuvix, Wright couldn't see it; "There isn't any moralizing," he observed. "It's just a story about a character, and you follow that character during the time he is alive. You watch the birth and the life and the death of one character in one episode, and there is no struggle between good and evil. It's purely a no-win situation." When asked if he thought Tuvix should be spared the separation at the episode's conclusion, Wright stated, "I think it was inevitable that he would be separated. There would be no drama without that separation. So, I completely agree that he should have been separated." (The Official Star Trek: Voyager Magazine issue 13)
The makeup department purposely shaded Tuvix lighter than Tuvok but darker than Neelix. Tuvix additionally had smaller versions of the pointed Vulcan ears built onto the Neelix head. (Star Trek: Aliens & Artifacts, p. 166)
Though the extensive makeup brought at least one complication, it wasn't too tough for Tom Wright to wear. "I had these contact lenses in and I couldn't see anything," Wright laughed. "But it wasn't really that hard. I did Creepshow 2 and Tales From the Crypt, so at least I was familiar with having to work with makeup." (The Official Star Trek: Voyager Magazine issue 13)
Following his one-episode appearance as Tuvix, Tom Wright hoped to play the character again. "I'm sorry to see Tuvix go," the performer admitted. "Anything can happen in the world of fiction, though. Tuvix could reappear, and if he did, I would be only too glad to step back into that role because it was a fun one." (The Official Star Trek: Voyager Magazine issue 13) Wright also related, "I think that in all fairness, if I were to play Tuvix again, it would be a lot easier simply because I'd know what I'd be walking into." (Star Trek Monthly issue 20, p. 59)
In their review of "Tuvix", authors Mark Jones and Lance Parkin labelled Tuvix as "basically a more happy-go-lucky Tuvok who can cook." (Beyond the Final Frontier, p. 294) Star Trek Magazine critic Nikki Harper commented that Tuvix was "played superbly by Tom Wright" and went on to say, "The physical appearance of this character is fascinating and one imagines that a lot of discussion went into his design." (Star Trek Monthly issue 20, p. 58)
External link Edit |
/// Create a `SELECT` query from the provided table.
pub fn from<T: IsTable>(&self) -> Select<'_, Db, T, AllColumns<T>>
where
Db: HasSqlType<Bool> + HasSqlType<SqlTypeOf<T::AllColumns>>,
{
Select::from_table(self)
} |
Oil multinationals and conflicts construction in oil-host communities in the Niger Delta
Oil-host communities in the Niger Delta have for over two decades been enmeshed in violent conflicts. These conflicts have resulted in numerous deaths, destruction of properties and entire communities. The proliferation of violent conflicts in the Niger Delta is a departure from the history of social, political and economic relations in the region before and during colonial rule. The paper interrogates the trajectories of conflict in the Niger Delta and states that the vitriolic relation within and between oil-host communities is a product of the antics of the oil multinationals. It argues that the business ethics of the oil multinationals are premised only on profit maximisation. Thus, they have actively aided and abetted state repression in the Niger Delta, and anchored their relations in oil-host communities, on partnership with those with power to violently disrupt their activities. The ethics and practice of the oil multinationals in oil-host communities besides conducing conflicts, eroded and fragmented traditional authority; giving rise to intense struggles by contending groups with their attendant violent outcomes. Three case studies are used to show the conflict conducing policies and practices of the oil multinationals in oil-host communities.
INTRODUCTION
The Niger Delta has for over two decades, been engulfed by oil-related conflicts that have taken various forms; community-state (security forces), community-oil company, intra-community, inter-community and interethnic. Examples include: Umuechem and the state 1990; Obagi and the state 1993, 1994; Odi and the state 1999; Soku and Nembe that spread to Sangama, Kula and Opukiri 1992, Eleme, Ogu and Okrika 1999, Ijaw and Itsekiri 1997Ogoni andAndoni 1993, 1994;Ke andBille 2001 Itsekiri andOkere Urhobo 1999;Bassambiri and Ogbolomabiri 2005; Afiesere and the state 2006; Okerenkoko, and the state 2006, Gbaramatu Kingdom and the state 2009, Ayakoromo and the state 2010. Most of these conflicts were internecine wars that caused acute destructions and severe constriction of human security that the Niger Delta could aptly be called a "zone of violence" (Keane, 1996). Although there are no clear statistics on the number of deaths arising from these conflicts, it is commonly acknowledged that these conflicts have resulted in large number of deaths and destruction of properties and in some cases entire communities in the region.
Admittedly, the Niger Delta, due to its riverine and swampy topography, has historically been extremely politically fragmented and subjected to frequent disputes over land, fishing rights, and sometimes over traditional leaders' sphere of influence (Emuedo et al., 2007). However, in spite of this, the history of social, political and economic relations in the region before and during colonial rule indicates that the area largely symbolised peace and was developing along a path, akin to many areas in today's Nigeria (Iyayi, 2008). Indeed, the natural resources; forests with animals and water bodies with fishes were shared freely by the people before the advent of oil.
An examination of the trajectories of conflicts and the cyclic nature of these conflicts would seem to suggest that the conflicts have been goaded by varied interests that may not be unconnected with the presence of oil in the region. Indeed, community-states conflicts are mostly the state's repressive response to the people's "combative reactionism" (Emuedo, 2010) to the "ecological war" (Eteng, 1997) foisted on the region, by unbridled oil activities. The acute repression in the region in the face of deleterious impacts of oil activities on the environment and the resultant poverty necessitated Okonta (2006) to remark that, the presence of the state is felt only in the form of machine guns and jackboots in the Niger Delta. Also, inter and intra-community conflicts in the region, appears driven by dimensions of intercommunal relations amongst communities in the region that is anchored on intense struggle for land, forests, creeks and swamps containing oil, contrary to erstwhile practices before the advent of oil. These conflicts that have acutely constricted human security in the Niger Delta have been linked to the business ethics and practices of the oil multinationals in oil-host communities (Omeje, 2004(Omeje, , 2006b. The paper interrogates the trajectories of conflict in the Niger Delta. It argues that though most conflicts are off-shoots of state's actions; the oil multinationals through their policies and practices actively aided and abetted conflicts in the region. Three case studies are presented to show how policies and practices the oil multinationals conduces conflicts in oilhost communities in the Niger Delta.
CONFLICT DYNAMICS IN OIL-HOST COMMUNITIES: A CONCEPTUAL FRAMEWORK
Many scholars regard conflict as an inevitability in human relations (Fraiser and Hipel, 1984:3;Burton, 1987aBurton, :8, 1987bOkoh and Ewhariemen, 2001:3-4). To Burton (1987b:138) "Conflict is an essential element in human relations ... the means to change ... and the means by which social values; welfare, security, justice and personal development may be achieved". In apparent support of this notion, Nnoli (1998:3-5) opined that conflict is not only a pervasive phenomenon in Emuedo 171 human relationships but often, it is the 'basic unit for understanding social existence'. Conflicts may be internal or external. External are conflicts that are not caused by interactions within the group or community but impact its functionality. On the other hand, internal conflicts may occur among or between actors within a group or community. Conflicts may be violent or non-violent. However, in any society, conflict, especially of the violent type is usually a harbinger of insecurity. But why do violent conflicts occur? Psychologists have noted that conflicts turn violent when the anger and or worries that give rise to frustration (the source of conflict) are not resolved. Also, avoidance or denial of conflict makes conflict violent, as the ignored group seeks to redress the issue at contention (Albert, 1999;Francis, 2006). Conflicts in most Third World societies have been blamed on factors, such as greed (Collier and Hoefler, 1998, 2002Collier et al., 2009); economic deprivation and social disorganisation (Keen, 1998, Draman 2003, Ikporukpo, 2003; grievance (Ikelegbe, 2006;Ukiwo, 2007); frustration and aggression (Goor et al., 1996;Emuedo et al, 2007); relative poverty (Dollard et al., 1939); conflicting interpretations of rights and responsibilities due to values difference (Olokesusi, 1996); exploitation and domination (Anele, 1999); and the failure of social contract (Murshed and Jadjoedin, 2008). Gurr (1970) opined that conflicts are caused by poverty and other factors having devastating impact on the progress of any society. The conflicts in oil-host communities in the Niger Delta appear to capture some aspects of the above perspectives. For instance, the Nigerian state has earned estimated $600 billion revenue from oil since 1956 (Watts, 2008) but the oil revenues have not touched the lives of the people. This is because the oil multinationals consider the oil-host communities irrelevant in their operations; as such, they have absolute disregard for their well-fare. This is exemplified by the fact that Shell, the pioneer oil multinational spent only a paltry 0.000007% of the over $30 billion of oil it extracted from the region on community assistance in 25 years (Rowell, 1994). Till date, the oil multinationals attitude to the region remains unchanged. As, such, the Niger Delta remained as described by Willink et al. (1958:34) "poor, backward, neglected". Thus, the Niger Delta is a place of amazing paradoxes. The region, suffers obtuse administrative deficit, decayed socio-economic infrastructure, and endemic poverty. Besides, these, the typical community in the Niger Delta is usually comprised of different and often conflicting groups; farmers, fishermen, traditional rulers, firewood cutters, hunters, unemployed youths, traders, etc. Thus, the communities are not homogenous but comprised of individual units having special needs based on several factors; who they are, where they live, their resources, livelihoods, the nature of their terrains, the problems created by state neglect; unemployment poverty and environmental despoliation from oil activities. It is clear therefore, that people inhabiting a community can be a source of social unrest. After the oil spill at Rumuekpe, Rivers State, in 1989, for instance, fishermen dug pits along the banks of the less polluted section of their lake to entrap fish. However, this was at variance with the farmers' intention to grow dry season crops on the available safe area. Often, in parts of the region firewood cutters damage farmers' crops, transporters damage river banks and fish traps, and cause turbulence in river channels. Also community leaders are sometimes in conflict with villagers arising from the seeming failure of the former to address the needs of the latter. Thus, myriads sources of discords exist in the communities.
Trajectories of conflicts in oil-host communities
As earlier mentioned, though some inter-communal competition and conflicts had occurred, the Niger Delta was largely characterised by peace. It was also suggested that the conflicts may be connected with the presence of oil in the Niger Delta. Indeed, Pa Saro-Wiwa, (2002:viii cited in Iyayi, 2008 alluded to this, when he asserted that "…were living in peace before Shell came. We were sharing our forest with animals and monkeys but when Shell came, they started setting one community against the other. They started with Andoni and Ogoni and before you knew it, they had started killing our people". As Iyayi (2008) asserted, the history of "setting one community against the other, and how, "before you knew it, they had started killing our people" is the history of oil activities; role of the "oil multinationals" in the region's progress; the oil multinationals methods of operations, and ramifications of their activities". The State has failed to mediate operations of the oil companies in the region, due its dependence, on oil rents and revenues. Since the mid 1960s oil emerged as the core source of state revenues, thus, a key issue in Nigerian politics. Indeed, control over oil was a key catalyst of the Nigerian civil war; 1967-70 that killed a million persons and displaced 6 million others (Ibeanu and Luckham, 2007). Since then, Nigeria has remained in a state of suppressed, 'silent' or 'structural' or 'repressive' violence (Galtung, 1976;Watts, 1983). In other words, oil became synonymous with conflict.
Therefore, conflicts in the oil-host communities have been goaded by varied oily interests. A 2010 study "Oil, The Nigerian State and Human Security in the Niger Delta" reported that initially; inter-community conflict was the most common in the Niger Delta (Emuedo, 2010). The report stated further that since 2000, the common forms of conflicts have been; community and state and community and oil companies. Community-states conflicts are mostly repressive actions of the state at ensuring steady oil flow in the region. This form of conflicts has exerted the greatest damage on the region.
Inter and intra-community conflicts, appears driven by dimensions of relations amongst oil-host communities that is anchored on intense struggle for what Watts (2004) has labelled governable spaces. These conflicts are often, over receipt of oil's tokenistic benefits. Intercommunity conflicts are caused mainly, by intercommunity struggle over benefits from oil companies; Intra-community conflicts are usually triggered by disagreement between community factions. The issues in contention may include land ownership petty contracts and compensation for damages. This may arise from rivalry between local comprador elites to position themselves as a bridge between the oil multinationals and the community or as a result of activities of vocal local elite "benefit captors" to capture community resources for themselves. This is because the oil multinationals often align with individuals or communities that could disrupt oil activities or suppress agitations against their operations. Thus, as Omeje (2004Omeje ( , 2006b asserted, the conflicts are closely linked to the antics of the oil multinationals in oil-host communities. Six identifiable intra-community factions and their role in intra-community conflict are shown in the Figure 1. Oil company-community conflicts are usually offshoots of a number of factors; oil spills and the associated ecological devastation; delays in the clean-up of areas impacted by oil spills; payment of inadequate compensation for damaged crops; oil multinationals' breach of Memorandum of Understanding (MOU) and patronage of community factions. Community and state conflicts have been triggered initially by neglect and deprivation of the region by the state. Whereas these triggered the conflict, the violent response of the state, to the policies of the oil multinationals in oil-host communities to ensure steady oil flow have sustained the conflicts. Some of these conflicts are discussed later in the work ( Figure 1).
Oil multinationals and insecurity in the Niger Delta
Oil operations it appears takes place mostly under dictatorships and or in conflict zones. The view that oil operation is intertwined with violent conflicts has been expressed by many writers (Nore and Turner, 1981;Yergin, 1991;Saro Wiwa, 1992;Watts, 2004). Indeed, evidences abound of the link between oil operations and conflicts in most oil producing regions of the world; Cambodia, Venezuela, Sudan, Chad, Iraq, Iran and of course Nigeria. Watts (2004) associated these oil-related conflicts to the quest for profit maximisation by the oil multinationals; hence, the disregard for best practice in their operations. Yergin (1991) epochal work "The Prize" espoused the close link between oil and conflicts in Third World countries since they discovered oil. Watts (2004) seem to share the same view by chronicling oil-related conflicts in oil producing areas of Venezuela, Peru, Colombia, Ecuador and Nigeria; arising from the oil multinational's impunity of operations. Thus, Ikporukpo (1996:159), noted that "Since the great gold rush, ..., no natural resource has attracted so much attention and generated so much boom and yet so much conflict as petroleum". One thing common to Third World oil producing countries is that the oil is found in ethnic minorities' areas. Ethnic majorities inherited and personifies the post colonial state; their attitude towards the ethnic minorities' oil producing areas as in the colonial state was predatory. Thus, areas were subjugated to internal colonialism for the purpose of revenue accumulation.
The basic structure of the colonial state was directed on establishing authority and control required for facilitating its primary objective of economic exploitation, as such, its laws empowered its agents (Multinational companies) to dominate and extract resources (Young, 1986:29). Thus, colonial policies were very congenial to the multinational companies (its agents) rather than the local people, as, it sponsored only the economic policies of the interest it represented; the acquisition of the resources to be used to advance British interests (Young, 1986: 31). As, such the multinational companies (its agents) often leveraged state policies in their favour. Post colonial Nigeria inherited the basic traits of the colonial state. Thus, as, in the colonial state, the oil multinationals, (its agents) have also had ample leverage over state policies. As a pioneer and largest oil producer, Shell has been specially privileged in leveraging state policies; its interests most often, coincide with that of the state. Consequently, state officials have been more concerned with interests of the oil multinationals, instead of the local people in the oil producing areas. The interest of the oil multinationals in the Niger Delta is the derivation of maximum revenues from oil; achievable only, by continuous oil flow. Also, the Nigerian state as Obi, (2004:173) opined, "depends almost wholly on revenues from oil. Thus, the dynamics and contradictions internally (economy, politics etc.,) of the state dictates that it coercively defends oil facilities". As, such, despite the acute deleterious impacts of oil activities in the Niger Delta, the state has ensured continuous oil flow by coercion and brutal repression of the people. This coincidence of interests in continuous oil flows between the oil multinationals and the state accounts for the former's utter disregard for repression in the Niger Delta.
Indeed, complicity of the oil multinationals in the vicious repressions in the Niger Delta is exemplified by their several actions; overt and covert to "oil" insecurity in the region. First, it was revealed at the sittings of the Oputa Panel (Human Rights Violations Investigations and Reconciliation Commission) that late dictator General Sani Abacha's life Presidency campaign got $40 million funding from the oil multinationals (Obi, 2001:173). In 2000, the oil multinationals gave over N7 billion to the Nigerian Navy for arms procurement to enable it combat attacks against their operations in the Niger Delta (The Comet, April 26, 2000:16). What is worthy of note is that the oil multinationals choose to arm the Navy rather than deploy this huge funds for the provision of social facilities to uplift the squalid state of the region. However, though the Navy was unable use the weapons procured to prevent insurgents' attacks on Nigeria's largest off-shore oil production and storage platform, Bonga in 2006 (Watts, 2007), it deftly used the weapons to destroy several communities; Odioma, 2005 1 , Gbaramatu Kingdom 2009 and Ayakoromo 2010 (Amaize, 2009;2010). In all instances, several hundreds of persons were killed, thousands displaced and almost the entire communities destroyed.
Second, individually, the oil multinationals, routinely offered logistics support to the security forces on repression mission in the Niger Delta. For instance, Shell paid field allowances of the men of the dreaded Rivers State Internal Security Task Force. The task force was set-up by late General Abacha's regime at the start of the Ogoni people's peaceful protests against Shell, over the deleterious effects of oil activities on their environment. The task force was headed by one Major Okuntimo, a man who boasted of knowing over one hundred ways of killing a human being. The task force turned Ogoniland into a garrison enclave; and subjected the people, to the worst acts of terror and dehumanisation. Acute repression of the Ogonis climaxed with the kangaroo trial and judicial murder of Ken Saro-Wiwa and eight of his compatriots in 1995. Shell was implicated in Saro-Wiwa's murder as it allegedly induced two key witnesses with money and job offers to give false testimonies against Saro-Wiwa (Manby, 1999a;Pegg, 1999:476;Greenpeace, 2001).
Indeed, Shell by several of its actions showed active support for state repression and its preference for an environment of insecurity rather than peace in the Niger Delta. For instance, barely three months after Saro-Wiwa's judicial murder, Shell provided logistics support and paid the field allowances of an army escort for its pipeline contractor Wilbros that killed one woman and injured 20 others in Ogoniland. Also, Shell procured 107 handguns and assorted weapons worth over $500,000 to the Nigeria police in the Niger Delta (Manby, 1999:175). Shell's supply of weapons to the police is not surprising, as, the Police has often, viciously attacked, killed and destroyed communities to deter protests against Shell's ruinous oil activities in the region. For instance, the police on Shell's invitation attacked unarmed protesters at Umuechem community in November 1990. The police killed 80 persons including the king and burnt 495 houses during the attack. Again in October 1999, on the invitation of Shell, the police attacked Choba community, where they raped 30 women, razed several houses and destroyed properties worth several millions. Other police attacks on communities on Shell's behalf include; Uwheru; 20 persons Killed and 11 houses burnt in January 2004, and Afiesere; 20 persons killed and over 80 houses burnt in 2006. Thus, the police deftly deployed the weapons supplied to it by Shell for the purpose for which they were supplied; killing, maiming of the Niger Delta people and destruction of their communities.
Shell has not been the only oil multinational involved in overt and or covert suppression of the Niger Delta people to ensure continuous oil flow. Chevron, an American oil multinational also routinely provided logistics for troops on repressive missions in the Niger Delta. For instance, on January 4, 1999, soldiers conveyed in a Chevron helicopter and three boats brutally attacked and sacked two villages (Opia and Ikenyan) in Delta State killing 7 persons, while 100 others were declared missing. Chevron offered to pay a paltry sum of $5,000 compensation to both communities when its complicity in the attacks (provision of logistics support to the soldiers) was reported. On another occasion, soldiers also, conveyed in Chevron helicopters opened fire on peaceful protesters killing 10 persons and injuring scores of others (Manby, 1999:175). These acts clearly evidence the collaborative role of the oil multinationals in the perpetuation of conflicts in the Niger Delta. These oil multinationals' collaborative actions with the state to suppress the people are besides their profit maximisation driven business ethics and antics in oil-host communities. Korten (1996:131,70-71), while commenting on the business ethics of oil multinationals in their host communities, noted that "their operations are premised on an ideology of relationship that: corporations should act solely on the basis of profitability without regard to impacts; absence of loyalty to place or community, and that relentless pursuit of profit leads to optimal results". According to Ashton-Jones (1998:130), the activities of oil multinationals are rooted in a culture that is founded on the assumptions that "profit maximisation is the basis for operating a business, and in the contest of the Niger Delta, what this means is that any expense beyond what is needed to get oil out of the ground is undesirable". This business ethics of the oil multinationals impacted on oilhost communities in two major ways with profound effects. Firstly, it led to impunity of oil activities with absolute lack of care for the environment. Thus, since the discovery of oil in the Niger Delta, oil activities have involved huge gas flaring, incessant oil spillages, indiscriminate waste dumping and absence of Environmental Impact Assessments (EIA). Secondly, the oil multinationals, to ensure continuous oil flow through their policies willingly destroyed the traditional bond and cohesion that hitherto existed in the oil-host communities, leading to incessant conflicts.
OIL MULTINATIONALS POLICIES CONDUCING CONFLICT IN OIL-HOST COMMUNITIES
The business ethics of the oil multinationals eroded social capital in the Niger Delta. They achieved this by preying on the pervasive poverty to pit the people against themselves. This impacted the sociological structure of oil-host communities, with adverse effects on social relations. Sociologically, social capital refers to the basic resources inherent in social relations that ease collective action; trust, norms and institutions that represent groups that meet regularly for common objectives. A feature of social capital is reciprocity; this promotes bargaining, conciliation and teamwork. These are vital elements for the maintenance and sustainability of community growth. Social capital therefore, engenders teamwork among groups, communities and institutions. Other related benefits include social elements like; information sharing, collective action, decision-making that deter clannish or opportunistic behaviour. In the Niger Delta the oil multinationals as a policy wittingly eroded social capital. They deployed divide and rule tactics, through loop sided sharing of tokenistic totems of recognition; annual diaries and calendars among or within oil-host communities. Land ownership was usually, the basis for recognition, as, a host community. As a result communities began laying claim to oil bearing lands or lands proposed for oilrelated projects. This led to intense struggle over land by many contiguous communities in the Niger Delta, as each wanted recognition as an oil host community. The struggle over land was such that communities that gave out land to their filial relations centuries ago suddenly began laying claim again to such lands. The counter claim by erstwhile recipients to such lands due to centuries of occupation led to struggle over oil bearing lands. Often, communities or sections of communities pitted against each other. Thus, hitherto peaceful communities with long filial relationships become embroiled in vitriolic conflicts. This led to the conflicts between the Kalabaris (Soku) and the Oluasiris (Nembe), in 1992; triggered by the decision to name a Shell gas project, "Soku Gas Plant". The conflict spread later to the neighbouring communities; Sangama, Kula and Opukiri. This also led to the Eleme, Ogu and Okrika Communal conflict and the gruesome murders in October 1999. The wars between Ogoni and most of its neighbours between 1993 and 1994: Andoni in July 1993, Okirika in December 1993, and Ndoki and Asa in April 1994 also derived from contention over land (Ibeanu, 2000:27). So also, was the Eleme, Ogu and Okrika Communal conflict in October, 1999. This was over the benefits accruing from being As if these were not enough, the oil multinationals through their community liaison officers also, stoked and "oiled" disharmony in oil-host communities. They routinely created greasy corporatist relationships with influential or vocal elites (local or urban) to sabotage communal interests. They induce such persons with contracts that are not expected to be executed; they are actually cash gifts, bribes or ex-gratia payments to such persons (Zalik, 2004;Omeje, 2006). This led to proliferation of oil industry sponsored cottage industry projects in oil-host communities, in the guise of community development. These projects were never commissioned for use. Hancock (1989) aptly, described assistance offered by the oil multinationals in the Niger Delta as follows; "roads that end at rivers and then continue blithely onward on the other side, electrification without power supplies, highly sophisticated equipment that no one can use, aquaculture projects producing dish at $4,000 per kilo for consumption by peasants who do not earn $400 per year". In other words, the oil multinationals spent money in the name of the people, rather than for the people. Also, the oil multinationals settled visible youth groups with payment of "stay at home" or "standby" money; and later, organised (arm) youth groups to protect their facilities as a Shell financed study revealed (WACS, 2003). These corporate practices inserted millions of dollars of "easy money" into individual hands, with youths the major beneficiaries as they became greatly empowered financially. The oil multinationals intended these actions to stem protests against their operations and attack on or sabotage of their facilities. These antics contributed to an environment in which militancy was encouraged and facilitated. Besides, they also corrupted the entire fabric of community leaderships, as families and sections of communities pitted against one another. As a result, the powers of traditional authorities became utterly eroded leading to leadership fragmentations in oilhost communities.
This condition greatly favoured the youths who acquired arms with their new found wealth, enhanced their capacity and began exerting themselves more forcefully. Soon they emerged as the fulcrum of power and the only group that could gain attention of the oil companies. As it were, only violence and disruption of oil activities attracted benefits from the oil multinationals. This compelled the traditional leaderships to hand over the responsibility for liaison and negotiation with the oil companies to the youths. In truth, as Alagoa (2000) asserted, youth leaders simply intimidated or violently pushed aside, their elders and traditional authorities and became the voice of the people. Kemedi (2003: 13-21) opined this was because the "oil multinationals related to the leadership fragmentation in the oil-host communities in terms of which faction was more powerful and disruptive as opposed to which faction was properly constituted and traditionally legitimate".
However, awareness of the fact that violence and disruptive actions against oil activities, often, earned "benefits" from the oil multinationals ignited waves of intra-communal conflicts and youth violence across oilhost communities. These conflicts resulted from competition by various youth groups to gain supremacy in their communities, and by implication, right of access to the oil multinationals and easy money. These conflicts in turn, impacted negatively on oil production, as they acutely disrupted oil activities. Frustrated, the oil multinationals began engaging private paramilitary security firms to secure their personnel, housing estates and facilities. Thus, over 10 mercenary companies have been operating in the Delta since 2005. These include; Triple Canopy, Control Risk, Erinys International (a British company with vast experience in Iraq), Armor Group, Aegis Defence System, and Northbridge Service Group; successor to the defunct Executive Outcomes; the South African paramilitary force employed by Angola during its war with Jonas Savimbi's UNITA rebels forces. Its personnel directly engaged in combat during the Sierra Leonean civil war. The mentality and psychology of these security personnel was that of soldiers on combat mission. As a result, their attitude was that of hostility; the Niger Delta people were considered enemies (Isima, 2007). As far as they were concerned, their assignment in the region is protection of the oil multinationals "rights" to carry out their business with impunity; get oil at very cheap rate to yield maximum profit. The brutalities that resulted from actions of these security personnel further complicated relations between the people especially the youths and the oil multinationals, leading to more conflicts. Exasperated, the oil multinationals prodded the state into acute militarisation of the entire oil-host communities with the Joint Military Task Force (JTF). The activities of the JTF as we all know led to the escalation of the conflict into a near full blown insurgency in late 2005. Three cases are hereunder used to empirically illustrate the nexus between oil multinationals actions and conflicts in oil-host communities. The first two illustrates conflicts arising from actions of comprador elite "benefit captors" aligned to the oil multinationals, while the third illustrates conflicts arising from oil multinationals' support for community factions.
Case 1: Egbemo Angalabiri community
A well-head failure in 1999 at Egbemo Angalabiri community led to oil spillage that destroyed communal fish ponds and the sources of water supply. As always, the traditional council promised to step into the matter. But arising from the "seemingly failure" of the traditional council to achieve meaningful results in the past, the youths that time decided to participate actively on that occasion. After several meetings between Shell and the community and owing to the combativeness of the youths, Shell admitted liability. The community demanded hundreds millions of dollars for damages caused by the spill as compensation. The stage was thus, set for negotiation between the community and Shell on the extent of compensation. The spill was very extensive and destructive and Shell had admitted culpability, thus, it had very little room to manoeuvre. Boxed in, as it were, Shell resorted to its old tricks, so, as, the negotiations were going on, Shell as usual made under-the-table payments to the paramount chief and members of his Council, to influence the community to accept a lower sum, than the amount proposed by the community as compensation and sent to Shell. However, the information about the payment was leaked to the youths. As a result, the youth leadership confronted some members of the traditional council who confirmed the information. The youths led a revolt against their paramount Chief and dethroned him together with his council of chiefs. Thereafter, the youths mounted a campaign to disrupt Shell's operations in and around their community. Shell promptly contacted the youth leadership and after a brief meeting, paid the amount demanded by the community as compensation. The youths thereafter sidelined the traditional council and took up the role of liaison and negation with the oil companies.
Case 2: Evwreni
Nigeria's pioneer and major oil producer Shell has several operating oil wells in Evwreni community in Ughelli North Local Government Area of Delta State. The Evwreni community entered into MoU (Memorandum of Understanding) with Shell for the provision of basic social amenities, offer of employments and most importantly payment of compensation for damages to properties (communal and individual) from Shell's activities in the area. Despite decades of numerous incidences of oil spills that have extensively damaged individual farmlands, communal fish ponds and shrine; Shell it seems failed to pay compensation to the community. This is despite assurances by the king whenever such incidents occurred that Shell would pay compensation. However, unknown to the people, Shell has been secretly paying to the king and a clique of chiefs all monies due to the community as compensations from its operations. In return, the king and these chiefs had ensured that no protest is mounted against Shell in the community. The king rewarded these chiefs with appointment as liaison between the community and the oil companies, after they successfully foisted the king on community. This is because it was the king's mother that hailed from the community. In a patriarchal society as the Niger Delta, this precludes him from the throne but these group of chiefs ensured that he was foisted on the community. This situation subsisted till 1999.
Around mid July 2000, a Shell contractor in connivance with some officials of Shell stole a well-head (Christmas tree) from an operating oil well near the community. The uncapped well spewed out crude oil about 30 metres into the air and rained down on the surrounding areas for over three weeks. The ecosystems of all contiguous communities to the oil well were seriously affected by the huge oil spill, inclusive of Evwreni. The youths on that occasion decided to confront Shell directly. However, as, the youths planned their mode of action, Shell contacted and made an under-the-table payment of a pitiable sum of N4 million to the King to use the security forces to coerce the youths' leadership. But this time as in Egbemo, a source leaked the information about the payment and the king's plan to use the security forces to coerce them. As a result, the youths quietly slipped into the forest on the day that the security forces were to arrive the town. Thus, when the security forces on invitation of the king flooded the community; all the youths were gone. About a week later, the youths leadership sent a deputation to the king, ostensibly to "sue for peace" and "to declare their allegiance" to his authority. The king thinking that he has won again asked the security forces to depart the town. But in what was akin to a coup, that same night after the security forces departed, the youths besiege the King's palace. After about an hour of gun battle, the king was captured. The youths killed the King in front of his family members, tied his dead body to a vehicle and dragged it round the whole community. Thereafter his dead body was put in cheap coffin and laid on the side of the Ughelli-Port Harcourt high way for over three months, before it was finally buried. After the death of the king, Shell promptly negotiated with the youths and then paid the compensation they demanded. As is to be expected, the youths thereafter, effectively took control of the community.
Case 3: Nembe
The intra-community crisis in Nembe offers a clear insight into the oil multinationals' nefarious antics and support for those with more disruptive power, at the expense of community cohesion in oil-host communities in the Niger Delta. Thus, giving insight to the fact that the oil multinationals preference to operate not only in an environment of conflict but that would keep the oil flowing no matter the cost to the people. This would explain why oil and blood has flowed side-by-side in the Niger Delta. It is therefore discussed in some more details.
There are four oil fields in Nembe that produces about Emuedo 177 150,000 barrels daily (Kemedi, 2003). Between 1985 and 2000, 50 oil spills incidents occurred in the community that spilled an estimated 500,000 barrels into the environment (Kemedi, 2003). These spills had a debilitating impact on the flora and fauna. As a result, in the late 1980s, the Nembe Council of Chiefs requested authority from their King to negotiate benefits and other tokens for the community with the oil companies. The King granted this request. This turned out to be the beginning of conflicts in the community. The initial conflict was spurred by the rivalry between the chiefs over the control of the benefits from the oil companies. This rivalry disrupted the community's traditional structure of power as the bond between the chiefs was broken, setting the stage for more challenges to traditional authorities. The first challenge to the community's traditional authority came from a youth group; the Isongo-foru. The group usurped the power of the king by stripping the Council of Chiefs of the power to negotiate on behalf of the community with the oil companies. Hitherto, the king in council constituted the sole authority in the community. This began when one Lionel Jonathan returned home to "improve" his community after resigning his job as a law lecturer at the Rivers State University of Science and Technology, Port Harcourt. On arrival, he built around himself, a power structure of youths that call themselves; the "House of Lords" but the group later changed its name to Isongo-foru. The group had a membership of a little over one hundred but it was well armed, giving it advantage over other groups. Based on reports by its community liaison officers, on the group's strength and visibility, Shell leveraged the group to protect its operations in the community from shutdowns. Shell also began to empower the Isongo-foru, to deter agitations from any other sources. Besides, the ample wealth, it amassed, Isongo-foru, also received arms supply from Shell, thus, it became largely unassailable in the community. The Isongo-foru's reign was absolute and not even the King in Council could challenge it. Several bloody clashes ensued between Isongo-foru and other rival youth groups in the community. In all these clashes, Shell actively supported the Isongo-foru against the other youth groups. The then government of Rivers state and later Bayelsa state deployed the police into the community in an attempt to control the conflict but this only led to more bloodshed. The insecurity in Nembe community deteriorated further in 1995 when, Mrs. Itari Kumbo-Garuba, a retired principal and wife of then Colonel Chris Garuba (now a retired army General), decided to challenge Isongo-foru's power over the community. She must have felt that she had the wherewithal to face the group; she was not only the spouse of a senior serving army officer but she was also then, a member of late General Abacha's constitutional conference. She assembled and financed a youth group called Agbara-foru that battled Isongo-foru for supremacy and by implication, access to the oil companies. The rivalry between the two contending groups led to three vitriolic clashes in the community on November 12 and 25 and December 14, 1995.
Arising from the viciousness of the conflict, Chief Hans Suku-Ogbari, the then Chairman of Nembe Council of Chiefs attempted to broker peace between the two groups but his efforts ended in failure. In his quest to stop the bloodletting, he requested the then Rivers State government to deploy men of the Mobile Police to arrest all the warring parties, including his own nephew. Thereafter, the Nembe Council of Chiefs placed a ban on the youth groups involved in the clashes. Surprisingly, however, some of the Chiefs were later arrested based on spurious allegations by some of the arrested youths that some of the Chiefs procured arms for the Agbaraforu. Thus, in a complex power game, the sponsors of Isongo-foru implicated their enemies on gun running and murder charges. These charges were never substantiated, and the report of the panel set up by then Rivers State government to investigate the conflict; believed to have indicted some highly placed persons was never released. The Agbara-foru faded out after this crisis but the Isongo-foru continued to grow in strength and audacity. Challenges to its hegemony were met with brute maniacal force until May 6, 2000, when the bubble bust.
The end came in an incongruous manner. The management of Shell on February 28, 2000 scheduled a meeting with the Nembe Council of Chiefs at its Eastern Headquarters Office in Port Harcourt. The meeting was to discuss the sum of N800 million that Shell claimed to have spent in Nembe community on developmental projects, whilst none existed. The intent of the meeting therefore, was to enable Shell enlighten the community on the "disappeared" funds. However, unknown to the Chiefs, the meeting was a mere ruse, as Shell's management never intended the meeting to hold as it would publicly expose corruption within the company. On the other hand, the Isongo-foru; an obvious recipient of some of the fund, regarded the meeting as a brazen affront to its unbridled powers and a threat to its liaison with Shell. The management of Shell and the Isongo-foru then connived to abort the meeting.
As a result, Shell's management delayed the meeting and kept the Chiefs waiting for over five hours in the company's waiting room. But although the Chiefs were deeply frustrated, they waited patiently. Shell's management sensing that the Chiefs could wait indefinitely motivated the Isongo-foru to chase the Chiefs off their premises. The Nembe Council of Chiefs complained to Shell's management about the lack of courtesy and protection for them even its own (Shell) premises. But Mr. Burham, Shell's Head of Community Relations retorted that the Chiefs unlike the youths have no power to close flow stations and therefore, not deserving serious attention from Shell. The Chiefs' reply to this taunt was to close the flow station in Nembe Creek without recourse to other parties. Shell called in the Isongo-foru, their allies, to re-open the flow stations in direct affront to the Chiefs. The entire Nembe community, even the other youth groups, felt aggrieved by the Isongo-foru's show of bravado and as a result, decided to move against the Isongo-foru, at any cost.
On the evening of May 5, 2000 Isongo-foru's top echelon prepared for a journey to Okpoama, a neighbouring community for the burial ceremony of one Christopher Peters, their secretary-general. Isongo-foru leadership sensing that conspiracy was afoot against them by the community youths decided to cow them again by getting them arrested. Most of those arrested were members of the Teme group (a predominantly spiritual youth movement). Though the Teme group had kept aloof from all the conflicts on spiritual grounds, they have nursed the intention of ousting the Isongo-foru, due to their excesses in the community. Thus, once the Isongo-foru leaders left for Okpoama, other Teme group members seized the Isongo-foru's armoury and rounded up all their members remaining in the community; thus, the Teme group completely neutralised the Isongo-foru in the community. A new other was proclaimed by the Isenasawo in the early hours of May 6, 2000 at the community square.
Conclusion
The rising tide of community conflicts, fragmentation and reconfiguration, identity mutation and reconstruction in the Niger Delta are all related to the dynamics of petropolitics. This is due to the creation of benefit captors in oil-host communities arising from the policies of the oil companies. The policies of the oil companies and the emergence of youth groups have heightened crime and violence in the politics of the Niger Delta oil communities and the region as a whole. The violent youth phenomenon and the general state of militancy and protests have made available enormous quantity of sophisticated arms and ammunitions. This has caused numerous feuds within and between communities that have led to very bloody and disruptive conflicts; that have; claimed many lives, massively destroyed villages and properties, disrupted oil facilities and production and general insecurity in the Niger Delta. Thus, the oil multinationals may need to reshape their policies to encourage community harmony if they are to operate in environment devoid of violence and relentless vitriolic conflicts. Those unfamiliar with events in the Niger Delta would want to dismiss the above narratives as mere gimmicks aimed at disparaging the image of the oil multinationals, especially Shell in the Niger Delta. It is a well known fact that for over three decades, there were no conflicts between the people and the oil multinationals, and the oil-host communities were not riddled with violent conflicts. Even when protests started, it was through peaceful means; picketing, deputations and legal actions. Indeed, in Nembe that later became epicentre of violent conflicts, the traditional council merely led the people to the town's waterside, where a letter was read and then handed over to the Council Chairman for onward transmission to the state Governor. For such critics, they need to explain the total sidelining of traditional authorities in oil-host communities and the vitriolic conflicts that followed since the 1990s. The answer lies in the above narratives. |
/** Object holding pagination information for an API request */
public class ResultLimit {
public final int offset;
public final int limit;
public ResultLimit(int limit) {
this(0, limit);
}
public ResultLimit(int offset, int limit) {
this.offset = offset;
this.limit = limit;
}
} |
def _compute_requires(
cls,
requires: Union[Type["Proc"], Sequence[Type["Proc"]]] = None,
) -> Sequence[Type["Proc"]]:
if requires is None:
requires = cls.requires
if requires is None:
return requires
if is_subclass(requires, Proc):
requires = [requires]
my_nexts = None if cls.nexts is None else cls.nexts[:]
for req in requires:
if req.nexts is None:
req.nexts = [cls]
else:
req.nexts.append(cls)
cls.nexts = my_nexts
return requires |
Republican presidential candidate Chris Christie said Thursday that corporate revenue that is stored overseas should be taxed at an 8.75 percent rate to pay for transportation projects in the nation.
Responding to a question about paying for a backlog in infrastructure spending in Thursday night’s Republican presidential debate in South Carolina, the New Jersey governor called for “a one-time repatriation” of overseas corporate revenue he estimated to total $2 trillion.
“Bring the money ... back to the United States, we’ll tax that one time at eight and three-quarters percent,” he said. “Because 35 percent of zero is zero, but eight three-quarters of $2 trillion is a lot of money. I would then dedicate that money to rebuilding infrastructure in this country.”
ADVERTISEMENT
The proposal to encourage companies to bring their profits back to the U.S., known as repatriation, has been floated often as replacement for the federal gas tax, which is traditionally used to pay for most of the nation’s transportation projects.
The gas tax has been set at 18.4 cents per gallon since 1993, but it has struggled to keep pace with mounting construction costs as cars have become more fuel efficient.
The federal government typically spends approximately $50 billion per year on transportation projects, but the gas tax only brings in about $34 billion per year. Lawmakers used about $70 billion from other areas of the federal budget to close the $16 billion annual shortfall for five years in a $305 billion highway bill that was passed late last year.
Most repatriation proposals that have been floated call for taxing overseas corporate taxes at rates between 6.5 and 14 percent.
President Obama has proposed a mandatory repatriation process that would require companies to bring back earnings to the United States, but most Republicans have pushed instead for a voluntary “tax holiday” to give companies an incentive to move money to domestic banks.
Critics have said voluntary repatriation plans would cost the federal government more in the long run than it brings in for transportation projects because companies would have more incentive to keep their profits abroad after the initial tax holiday.
Christie pitched the repatriation proposal in Thursday’s debate as way to avoid to asking drivers to pay more at the pump to help finance transportation projects.
“It would not necessitate us raising any taxes,” he said. “It would bring money back into the United States to help build jobs by American companies and get our economy moving again and growing at a much higher rate, and it would rebuild those roads and bridges and tunnels that you were talking about.” |
def check_allowed_extensions(self, extension) -> str:
raise NotImplementedError("Orchestrators should implement this!") |
/**
* Callback function which reads only from the primary socket.
*
* @param socket
* The tee socket to read from.
*
* @param buf
* The buffer to read data into.
*
* @param count
* The maximum number of bytes to read into the given buffer.
*
* @return
* The value returned by guac_socket_read() when invoked on the primary
* socket with the given parameters.
*/
static ssize_t __guac_socket_tee_read_handler(guac_socket* socket,
void* buf, size_t count) {
guac_socket_tee_data* data = (guac_socket_tee_data*) socket->data;
return guac_socket_read(data->primary, buf, count);
} |
/*
* Disable a kernel software provider.
* This implements the "cryptoadm disable" command for
* kernel software providers.
*/
int
disable_kef_software(char *provname, boolean_t rndflag, boolean_t allflag,
mechlist_t *dislist)
{
crypto_load_soft_disabled_t *pload_soft_dis = NULL;
mechlist_t *infolist = NULL;
entry_t *pent = NULL;
entrylist_t *phardlist = NULL;
entrylist_t *psoftlist = NULL;
boolean_t in_kernel = B_FALSE;
int fd = -1;
int rc = SUCCESS;
if (provname == NULL) {
return (FAILURE);
}
if (check_kernel_for_soft(provname, NULL, &in_kernel) == FAILURE) {
return (FAILURE);
} else if (in_kernel == B_FALSE) {
cryptoerror(LOG_STDERR,
gettext("%s is not loaded or does not exist."),
provname);
return (FAILURE);
}
if (get_kcfconf_info(&phardlist, &psoftlist) == FAILURE) {
cryptoerror(LOG_ERR,
"failed to retrieve the providers' "
"information from the configuration file - %s.",
_PATH_KCF_CONF);
return (FAILURE);
}
pent = getent_kef(provname, phardlist, psoftlist);
if (pent == NULL) {
pent = create_entry(provname);
if (pent == NULL) {
cryptodebug("out of memory.");
rc = FAILURE;
goto out;
}
}
if (get_soft_info(provname, &infolist, phardlist, psoftlist) ==
FAILURE) {
rc = FAILURE;
goto out;
}
if ((infolist != NULL) && (infolist->name[0] != '\0')) {
free_mechlist(pent->suplist);
pent->suplist = infolist;
}
if (!rndflag) {
(void) filter_mechlist(&infolist, RANDOM);
}
if (disable_mechs(&pent, infolist, allflag, dislist) == FAILURE) {
rc = FAILURE;
goto out;
}
if (update_kcfconf(pent, MODIFY_MODE) == FAILURE) {
rc = FAILURE;
goto out;
}
if ((pload_soft_dis = setup_soft_dis(pent)) == NULL) {
rc = FAILURE;
goto out;
}
if ((fd = open(ADMIN_IOCTL_DEVICE, O_RDWR)) == -1) {
cryptoerror(LOG_STDERR,
gettext("failed to open %s for RW: %s"),
ADMIN_IOCTL_DEVICE, strerror(errno));
rc = FAILURE;
goto out;
}
if (ioctl(fd, CRYPTO_LOAD_SOFT_DISABLED, pload_soft_dis) == -1) {
cryptodebug("CRYPTO_LOAD_SOFT_DISABLED ioctl failed: %s",
strerror(errno));
rc = FAILURE;
goto out;
}
if (pload_soft_dis->sd_return_value != CRYPTO_SUCCESS) {
cryptodebug("CRYPTO_LOAD_SOFT_DISABLED ioctl return_value = "
"%d", pload_soft_dis->sd_return_value);
rc = FAILURE;
goto out;
}
out:
free_entrylist(phardlist);
free_entrylist(psoftlist);
free_mechlist(infolist);
free_entry(pent);
free(pload_soft_dis);
if (fd != -1)
(void) close(fd);
return (rc);
} |
/**
* Returns List with the names of all tables in the schema
*
* @return
*/
@Override
public List<String> selectAllTables() {
List<String> listWithTables = new ArrayList<>();
try {
ResultSet resultset = mySqlStatement.executeQuery(SELECT_ALL_TABLES);
return extractListFromResultSet(resultset, columnNameIndex);
} catch (SQLException throwables) {
throwables.printStackTrace();
}
return listWithTables;
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.