--- /dev/null
+ GNU GENERAL PUBLIC LICENSE
+ Version 3, 29 June 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU General Public License is a free, copyleft license for
+software and other kinds of works.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+the GNU General Public License is intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users. We, the Free Software Foundation, use the
+GNU General Public License for most of our software; it applies also to
+any other work released this way by its authors. You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ To protect your rights, we need to prevent others from denying you
+these rights or asking you to surrender the rights. Therefore, you have
+certain responsibilities if you distribute copies of the software, or if
+you modify it: responsibilities to respect the freedom of others.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must pass on to the recipients the same
+freedoms that you received. You must make sure that they, too, receive
+or can get the source code. And you must show them these terms so they
+know their rights.
+
+ Developers that use the GNU GPL protect your rights with two steps:
+(1) assert copyright on the software, and (2) offer you this License
+giving you legal permission to copy, distribute and/or modify it.
+
+ For the developers' and authors' protection, the GPL clearly explains
+that there is no warranty for this free software. For both users' and
+authors' sake, the GPL requires that modified versions be marked as
+changed, so that their problems will not be attributed erroneously to
+authors of previous versions.
+
+ Some devices are designed to deny users access to install or run
+modified versions of the software inside them, although the manufacturer
+can do so. This is fundamentally incompatible with the aim of
+protecting users' freedom to change the software. The systematic
+pattern of such abuse occurs in the area of products for individuals to
+use, which is precisely where it is most unacceptable. Therefore, we
+have designed this version of the GPL to prohibit the practice for those
+products. If such problems arise substantially in other domains, we
+stand ready to extend this provision to those domains in future versions
+of the GPL, as needed to protect the freedom of users.
+
+ Finally, every program is threatened constantly by software patents.
+States should not allow patents to restrict development and use of
+software on general-purpose computers, but in those that do, we wish to
+avoid the special danger that patents applied to a free program could
+make it effectively proprietary. To prevent this, the GPL assures that
+patents cannot be used to render the program non-free.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Use with the GNU Affero General Public License.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU Affero General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the special requirements of the GNU Affero General Public License,
+section 13, concerning interaction through a network will apply to the
+combination as such.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If the program does terminal interaction, make it output a short
+notice like this when it starts in an interactive mode:
+
+ <program> Copyright (C) <year> <name of author>
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, your program's commands
+might be different; for a GUI interface, you would use an "about box".
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU GPL, see
+<http://www.gnu.org/licenses/>.
+
+ The GNU General Public License does not permit incorporating your program
+into proprietary programs. If your program is a subroutine library, you
+may consider it more useful to permit linking proprietary applications with
+the library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License. But first, please read
+<http://www.gnu.org/philosophy/why-not-lgpl.html>.
+
--- /dev/null
+This is a simple user-space port-forwarder.
+I wrote it in a bit of hurry because I needed one.
+You are welcome to use it, too, if it suits your needs;
+it is available under the GPLv3 (or, at your option, any
+later version); please see the file COPYING for details.
+
+Note that the unity/ folder isn't my work, and is
+available under a different licence; see the README
+there for details.
+
+Chris Jaekl
+cejaekl@yahoo.com
+www.jaekl.net
--- /dev/null
+CC=gcc
+CFLAGS=-O2 -g
+LDFLAGS=-g
+
+OBJS=fwd.o qderrhandler.o qdsocket.o
+
+all: fwd
+
+clean:
+ rm *.o fwd
+
+fwd: $(OBJS)
+ $(CC) $(LDFLAGS) -o fwd $(OBJS)
+
+fwd.o: fwd.c qderrhandler.h qdsocket.h
+ $(CC) $(CFLAGS) -c fwd.c
+
+qderrhandler.o: qderrhandler.c qderrhandler.h
+ $(CC) $(CFLAGS) -c qderrhandler.c
+
+qdsocket.o: qdsocket.c qderrhandler.h qdsocket.h qdtypes.h
+ $(CC) $(CFLAGS) -c qdsocket.c
+
--- /dev/null
+/*
+ * Quick-and-dirty userspace port forwarder.
+ *
+ * There are a bunch of things that should be cleaned up here:
+ * - the (limited) user-interface strings are hardcoded; should use a look-up table.
+ * - should have some administrative logging (perhaps syslog)
+ * - code to handle certain plausible (but unlikely) conditions remains a "TODO".
+ * - if there are a lot of simultaneous connections, the linear search after a select() could be a problem
+ * - the qdSocket library functions need some performance work
+ *
+ * On the plus side, the code is small, and reasonably efficient on a
+ * light-duty server. I.e., "it works for me."
+ */
+
+#include <assert.h>
+#include <arpa/inet.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <netdb.h>
+#include <netinet/in.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/socket.h>
+#include <sys/time.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+#include "qderrhandler.h"
+#include "qdsocket.h"
+
+#define MAX_ACCEPTED 50 // maximal number of concurrent connections
+
+void usage(const char * myName)
+{
+ printf("Usage: %s myPort host:otherPort\n", myName);
+ printf(" Forwards tcp received on myPort to host:otherPort.\n");
+}
+
+void fillFds(int * highest_sd, struct qdSocket incoming[], struct qdSocket outgoing[], fd_set * readFds, fd_set * writeFds)
+{
+ int idx;
+
+ FD_ZERO(readFds);
+ FD_ZERO(writeFds);
+
+ // Special case: the listening server socket, on which we read but never write
+ FD_SET(incoming[0].sd, readFds);
+ *highest_sd = incoming[0].sd;
+
+ for (idx = 1; idx < MAX_ACCEPTED; ++idx) {
+ int sd;
+
+ qdSockCheckClose(&(incoming[idx]));
+ sd = incoming[idx].sd;
+ if (sd > *highest_sd) {
+ *highest_sd = sd;
+ }
+ if (0 != sd) {
+ FD_SET(sd, readFds);
+ FD_SET(sd, writeFds);
+ }
+
+ qdSockCheckClose(&(outgoing[idx]));
+ sd = outgoing[idx].sd;
+ if (sd > *highest_sd) {
+ *highest_sd = sd;
+ }
+ if (0 != sd) {
+ FD_SET(sd, readFds);
+ FD_SET(sd, writeFds);
+ }
+ }
+}
+
+void writeError(struct qdSocket *to, char * buf)
+{
+ ssize_t len = strlen(buf);
+ ssize_t written = 0;
+
+ written = qdSockWrite(to, buf, len);
+ if (written != len) {
+ printf("WARNING: Tried to report the following on sd %ld, but could not: %s\n",
+ (long)(to->sd), (buf ? buf : "<NULL>"));
+ }
+}
+
+void forwardFromTo(struct qdSocket *from, struct qdSocket *to)
+{
+ char buf[QD_SOCK_BUF_SIZE];
+ ssize_t n;
+ ssize_t maxToRead;
+ ssize_t writeBufAvail;
+
+ maxToRead = QD_SOCK_BUF_SIZE - (to->toWrite);
+
+ if (maxToRead <= 0) {
+ //printf("WARNING: write buffer full on sd %ld. Pending read on sd %ld deferred.\n",
+ // (long)(to->sd), (long)(from->sd));
+ return;
+ }
+
+ memset(buf, 0x00, QD_SOCK_BUF_SIZE);
+
+ n = read(from->sd, buf, maxToRead);
+ if (n <= 0) {
+ qdSockClose(from);
+ qdSockClose(to);
+ }
+ else {
+ qdSockWrite(to, buf, n);
+ }
+
+ // printf("\nRead-and-write: \"%s\"\n", buf);
+}
+
+void readSockets(struct qdSocket incoming[], struct qdSocket outgoing[], fd_set * readFds, const char *otherHost, int otherPort)
+{
+ int idx;
+
+ // Special case: the listening server socket
+ if (FD_ISSET(incoming[0].sd, readFds)) {
+ doAccept(incoming, outgoing, otherHost, otherPort);
+ }
+
+ for (idx = 1; idx < MAX_ACCEPTED; ++idx) {
+ if (FD_ISSET(incoming[idx].sd, readFds)) {
+ forwardFromTo(&(incoming[idx]), &(outgoing[idx]));
+ }
+ if (FD_ISSET(outgoing[idx].sd, readFds)) {
+ forwardFromTo(&(outgoing[idx]), &(incoming[idx]));
+ }
+ }
+}
+
+void writeSockets(struct qdSocket incoming[], struct qdSocket outgoing[], fd_set * writeFds)
+{
+ int idx;
+
+ assert(! FD_ISSET(incoming[0].sd, writeFds));
+
+ for (idx = 1; idx < MAX_ACCEPTED; ++idx) {
+ if (FD_ISSET(incoming[idx].sd, writeFds)) {
+ qdSockFlush(incoming + idx);
+ }
+ if (FD_ISSET(outgoing[idx].sd, writeFds)) {
+ qdSockFlush(outgoing + idx);
+ }
+ }
+}
+
+void setNonBlocking(int sd)
+{
+ int opt;
+
+ opt = fcntl(sd, F_GETFL);
+ if (opt < 0) {
+ qdAbort("fcntl(sd, F_GETFL) failed", opt);
+ }
+ opt |= O_NONBLOCK;
+ opt = fcntl(sd, F_SETFL, opt);
+ if (opt < 0) {
+ qdAbort("fcntl(sd, F_SETFL) failed", opt);
+ }
+}
+
+int doAccept(struct qdSocket incoming[], struct qdSocket outgoing[], const char *otherHost, int otherPort )
+{
+ int i;
+ int new_sd;
+ int ret;
+ int sin_size = sizeof(struct sockaddr_in);
+ struct sockaddr_in theirAddr;
+ char * p;
+
+ new_sd = accept(incoming[0].sd, (struct sockaddr *)&theirAddr, &sin_size);
+ if (new_sd <= 0) {
+ qdAbort("Could not accept() incoming connection.", new_sd);
+ }
+
+ p = inet_ntoa(theirAddr.sin_addr);
+
+ printf("Connection received from %s:%d, using sd %d.\n",
+ (p ? p : "<NULL>"),
+ theirAddr.sin_port,
+ new_sd);
+
+ setNonBlocking(new_sd);
+
+ for (i = 0; i < MAX_ACCEPTED; ++i) {
+ if (0 == incoming[i].sd) {
+ incoming[i].sd = new_sd;
+ new_sd = (-1);
+ break;
+ }
+ }
+
+ if (new_sd >= 0) {
+ struct qdSocket temp;
+ qdSockInit(&temp);
+ temp.sd = new_sd;
+ writeError(&temp, "Sorry, the server is too busy at the moment (too many open connections). Please wait a while and then try again.");
+ qdSockClose(&temp);
+ return (-1);
+ }
+
+ assert (0 == outgoing[i].sd);
+
+ ret = qdSockConnect(&(outgoing[i]), otherHost, otherPort);
+ if (0 != ret) {
+ // Could not connect. Most likely, otherHost:otherPort is (temporarily?) unavailable
+ // We intentionally do not explain which host and port are unavailable, to avoid leaking
+ // information about the internal network structure to outside parties.
+ writeError(&(incoming[i]), "Sorry, the server is currently down. Please wait a while and then try again.");
+ qdSockClose(&(incoming[i]));
+ return (-1);
+ }
+
+ return i;
+}
+
+
+void forward(int myPort, const char *otherHost, int otherPort)
+{
+ char * p = NULL;
+ int on = 0;
+ int server_sd = 0;
+ int idx = (-1);
+ int numSignalled = 0;
+ int ret = 0;
+ struct sockaddr_in myAddr;
+ struct qdSocket * incoming;
+ struct qdSocket * outgoing;
+ int highest_sd = 0;
+ fd_set readFds;
+ fd_set writeFds;
+ struct timeval timeout;
+
+ incoming = (struct qdSocket *)malloc(MAX_ACCEPTED * sizeof(struct qdSocket));
+ outgoing = (struct qdSocket *)malloc(MAX_ACCEPTED * sizeof(struct qdSocket));
+
+ if (NULL == incoming) {
+ qdAbort("Failed to calloc() incoming. Out of memory?", 0);
+ }
+ if (NULL == outgoing) {
+ qdAbort("Failed to calloc() outgoing. Out of memory?", 0);
+ }
+
+ for (idx = 0; idx < MAX_ACCEPTED; ++idx) {
+ qdSockInit(&(incoming[idx]));
+ qdSockInit(&(outgoing[idx]));
+ }
+
+ server_sd = socket(AF_INET, SOCK_STREAM, 0);
+ if (server_sd < 0) {
+ qdAbort("Could not allocate socket descriptor.", server_sd);
+ }
+
+ ret = setsockopt(server_sd, SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof(on));
+ if (ret < 0) {
+ qdAbort("Could not set socket options.", ret);
+ close(server_sd);
+ }
+
+ incoming[0].sd = server_sd;
+
+ memset(&myAddr, 0x00, sizeof(struct sockaddr_in));
+ myAddr.sin_family = AF_INET;
+ myAddr.sin_port = htons(myPort);
+ myAddr.sin_addr.s_addr = htonl(INADDR_ANY);
+
+ ret = bind(server_sd, (struct sockaddr *)&myAddr, sizeof(myAddr));
+ if (ret < 0) {
+ qdAbort("Could not bind() socket.", ret);
+ }
+
+ printf("Listening on %d...\n", myPort);
+
+ ret = listen(server_sd, MAX_ACCEPTED); // allow a backlog of up to MAX_ACCEPTED pending connections
+ if (ret < 0) {
+ qdAbort("Could not listen() on socket.", ret);
+ }
+
+ highest_sd = server_sd;
+ incoming[0].sd = server_sd;
+
+ do {
+ fillFds(&highest_sd, incoming, outgoing, &readFds, &writeFds);
+
+ timeout.tv_sec = 1;
+ timeout.tv_usec = 0;
+
+ numSignalled = select(highest_sd + 1, &readFds, &writeFds, NULL, &timeout);
+ if (0 == numSignalled) {
+ // printf("."); fflush(stdout);
+ }
+ else {
+ readSockets(incoming, outgoing, &readFds, otherHost, otherPort);
+ writeSockets(incoming, outgoing, &writeFds);
+ }
+ } while ( 1 );
+
+ free(incoming);
+ free(outgoing);
+}
+
+int main(int argc, char **argv)
+{
+ int myPort = 0;
+ int otherPort = 0;
+ char * otherHost = "";
+ char * p = NULL;
+
+ if (3 != argc) {
+ usage(argv[0]);
+ return 1;
+ }
+
+ myPort = atoi(argv[1]);
+
+ p = strrchr(argv[2], ':');
+ if (NULL == p) {
+ usage(argv[0]);
+ return 2;
+ }
+ *p = 0;
+ ++p;
+ otherPort = atoi(p);
+
+ otherHost = argv[2]; // note that :port has been truncated off
+
+ forward(myPort, otherHost, otherPort);
+ return 0; // unreachable
+}
+
--- /dev/null
+/*
+ * QuanDocs error handling routines.
+ *
+ * Copyright (C) 2015 Chris Jaekl
+ */
+
+#include <errno.h>
+
+#include "qderrhandler.h"
+
+void qdAbort_impl(const char *die_msg, long die_retCode, const char *file, long line)
+{
+ printf("%s:%ld %s\nReturn code %ld, errno %d\n",
+ file, line, die_msg, die_retCode, (int)errno);
+ abort();
+}
+
--- /dev/null
+/*
+ * QuanDocs error handling and logging.
+ *
+ * Copyright (C) 2004 by Chris Jaekl
+ */
+
+#ifndef __QD_ERRHANDLER_H__
+#define __QD_ERRHANDLER_H__
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#define qdAbort(die_msg, die_retCode) qdAbort_impl(die_msg, die_retCode, __FILE__, __LINE__)
+
+void qdAbort_impl(const char *die_msg, long die_retCode, const char *file, long line);
+
+#endif /* __QD_ERRHANDLER_H__ */
+
--- /dev/null
+/*
+ * QuanDocs socket API.
+ * (Convenience wrapper around BSD sockets)
+ *
+ * Copyright (C) 2004, 2015 by Chris Jaekl
+ */
+
+#include <arpa/inet.h>
+#include <errno.h>
+#include <netdb.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+
+#include "qdunittest.h"
+
+#include "qderrhandler.h"
+#include "qdsocket.h"
+#include "qdtypes.h"
+
+void qdSockCheckClose(struct qdSocket *sock)
+{
+ if ((sock->closeRequested) && (0 == sock->toWrite)) {
+ // printf("\nCLOSE(%d)\n", sock->sd);
+ close(sock->sd);
+ memset(sock, 0x00, sizeof(struct qdSocket));
+ }
+}
+
+
+
+void qdSockClose(struct qdSocket *sock)
+{
+ assert(NULL != sock);
+
+ if (0 == sock->sd) {
+ return;
+ }
+
+ sock->closeRequested = TRUE;
+ qdSockCheckClose(sock);
+}
+
+// Returns 0 on success, non-zero on failure
+int qdSockConnect(struct qdSocket *sock, const char * host, int port)
+{
+ int ret = 0;
+ struct hostent * he;
+ struct sockaddr_in sa;
+
+ assert(NULL != sock);
+ assert(0 == sock->sd);
+ assert(0 == sock->closeRequested);
+
+ memset(&sa, 0x00, sizeof(struct sockaddr_in));
+
+ he = gethostbyname(host);
+ if (NULL == he) {
+ qdAbort("gethostbyname() failed", h_errno);
+ }
+
+
+ sa.sin_family = AF_INET;
+ sa.sin_port = htons(port);
+ memcpy(&(sa.sin_addr), (he->h_addr_list[0]), sizeof(struct in_addr));
+
+ sock->sd = socket(AF_INET, SOCK_STREAM, 0);
+ if (sock->sd < 0) {
+ qdAbort("Could not create client socket.", sock->sd);
+ }
+
+ ret = connect(sock->sd, (struct sockaddr *)&sa, sizeof(sa));
+ if (ret < 0) {
+ return ret; // Could not connect
+ }
+}
+
+
+ssize_t qdSockFlush(struct qdSocket *to)
+{
+ ssize_t written;
+ char * p;
+ char * q;
+ int idx;
+
+ written = write(to->sd, to->buf, to->toWrite);
+ if (written >= 0) {
+ assert(written <= to->toWrite);
+ to->toWrite -= written;
+
+ p = to->buf;
+ q = p + written;
+ for (idx = 0; idx < to->toWrite; ++idx) {
+ *p = *q;
+ p++;
+ q++;
+ }
+ }
+ else if (((-1) == written) && ((EAGAIN == errno) || (EWOULDBLOCK == errno))) {
+ // Socket is busy, leave pending write for later
+ written = 0;
+ }
+ else {
+ // Some unexpected error has occurred on the socket.
+ // Close it.
+ to->toWrite = 0; // abandon unwritten data that we cannot flush
+ // TODO: optionally log this condition, so that a sysadmin can see what's happening
+ qdSockClose(to);
+ }
+
+ return written;
+}
+
+void qdSockInit(struct qdSocket *sock)
+{
+ memset(sock, 0x00, sizeof(struct qdSocket));
+}
+
+ssize_t qdSockWrite(struct qdSocket *to, char * buf, ssize_t n)
+{
+ assert(NULL != to);
+ assert(NULL != buf);
+ ssize_t written;
+
+ if ((to->toWrite + n) > QD_SOCK_BUF_SIZE) {
+ // TODO: implement this functionality
+ qdAbort("Unimplemented: write buffer overflow. Aborting.", 0);
+ }
+
+ // TODO: should be smarter here (use a circular buffer to avoid O(n^2) worst-case performance)
+ memcpy((to->buf + to->toWrite), buf, n);
+ to->toWrite += n;
+
+ return qdSockFlush(to);
+}
+
+
--- /dev/null
+/*
+ * QuanDocs socket API.
+ * (Convenience wrapper around BSD sockets)
+ *
+ * Copyright (C) 2004, 2015 by Chris Jaekl
+ */
+
+#ifndef __QD_SOCKET_H__
+#define __QD_SOCKET_H__
+
+#include <assert.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+
+#define QD_SOCK_BUF_SIZE 32768
+
+struct qdSocket {
+ int sd; // socket (file) descriptor
+ int toWrite; // number of bytes in buf (starting from [0]) that are waiting to be written
+ char closeRequested; // boolean: has qdClose() been called on this socket?
+ char buf[QD_SOCK_BUF_SIZE];
+};
+
+void qdSockCheckClose(struct qdSocket *sock);
+
+void qdSockClose(struct qdSocket *sock);
+
+// Returns 0 on success, non-zero on failure
+int qdSockConnect(struct qdSocket *sock, const char * host, int port);
+
+void qdSockInit(struct qdSocket *sock);
+
+// Returns # of bytes actually written by this flush operation
+ssize_t qdSockFlush(struct qdSocket *to);
+
+ssize_t qdSockWrite(struct qdSocket *to, char * buf, ssize_t n);
+
+#endif /* __QD_SOCKET_H__ */
+
--- /dev/null
+/*
+ * QuanDocs general header
+ *
+ * Copyright (C) 2004 Chris Jaekl
+ */
+
+#ifndef __QD_TYPES_H__
+#define __QD_TYPES_H__
+
+#ifndef TRUE
+# define TRUE (-1)
+# define FALSE 0
+#endif
+
+#endif /* __QD_TYPES_H__ */
--- /dev/null
+/*
+ * QuanDocs unit test mock injection
+ *
+ * For some of our unit tests, we will want to override some libc functions with mock versions.
+ * I could do this by playing games with object link order and using dlsym(RTLD_NEXT) to follow the chain.
+ *
+ * But, that gets a bit tricky. For example, consider mocking write(), but leaving printf(), which may
+ * well be implemented in a way that calls write(stdout, ...), unintercepted.
+ *
+ * Thus, I opt to use a compile-time #define to reroute only our explicit calls to the libc functions
+ * to their mock variants.
+ */
+
+#ifndef __QD_UNITTEST_H__
+#define __QD_UNITTEST_H__
+
+#ifdef QD_UNITTEST
+# define read(fd, buf, count) qdMock_read(fd, buf, count)
+# define write(fd, buf, count) qdMock_write(fd, buf, count)
+#endif /* QD_UNITTEST */
+
+#endif /* __QD_UNITTEST_H__ */
+
+
--- /dev/null
+CC=gcc
+CFLAGS=-g -DQD_UNITTEST
+
+PROD_DIR=../prod
+
+MOCK_CODE=mock_io.c mock_qderrhandler.c
+MOCK_DEPS=$(MOCK_CODE) mock_io.h
+
+UNITY_DIR=../unity/src
+UNITY_CODE=$(UNITY_DIR)/unity.c
+UNITY_DEPS=$(UNITY_CODE) $(UNITY_DIR)/unity.h $(UNITY_DIR)/unity_internals.h
+
+COMMON_CODE=$(MOCK_CODE) $(UNITY_CODE)
+COMMON_DEPS=$(MOCK_DEPS) $(UNITY_DEPS) qdtestcase.h
+
+INC_DIRS=-I$(UNITY_DIR) -I$(PROD_DIR)
+
+all: test_qdsocket
+
+test_qdsocket: test_qdsocket.c $(PROD_DIR)/qdsocket.c $(PROD_DIR)/qdsocket.h $(COMMON_DEPS)
+ $(CC) $(CFLAGS) $(INC_DIRS) -o test_qdsocket test_qdsocket.c $(PROD_DIR)/qdsocket.c $(COMMON_CODE)
+ ./test_qdsocket
--- /dev/null
+/*
+ * QuanDocs mock I/O routines for unit testing.
+ *
+ * Copyright (C) 2015 Chris Jaekl
+ */
+
+#include <assert.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "mock_io.h"
+
+static void * readBuf = NULL;
+static ssize_t readBufSize = 0;
+static ssize_t readPos = 0;
+
+static void * writeBuf = NULL;
+static ssize_t writeBufSize = 0;
+static ssize_t writePos = 0;
+
+ssize_t qdMock_read(int fd, void *buf, size_t count)
+{
+ assert(NULL != readBuf);
+
+ if (readPos < readBufSize) {
+ ssize_t remain = readBufSize - readPos;
+ ssize_t num = (count <= remain) ? count : remain;
+ unsigned char * p = (unsigned char *)readBuf;
+ p += readPos;
+
+ memcpy(buf, p, num);
+ readPos += num;
+ return num;
+ }
+ return 0; // EOF
+}
+
+void qdMock_resetReadBytes(void *buf, size_t count)
+{
+ if (NULL != readBuf) {
+ free(readBuf);
+ }
+ readBuf = malloc(count);
+ assert(NULL != readBuf);
+
+ memcpy(readBuf, buf, count);
+
+ readBufSize = count;
+ readPos = 0;
+}
+
+ssize_t qdMock_getNumBytesRead() {
+ return readPos;
+}
+
+
+ssize_t qdMock_write(int fd, void *buf, size_t count)
+{
+ assert((0 == writeBufSize) || (NULL != writeBuf));
+
+ if (writePos < writeBufSize) {
+ ssize_t remain = writeBufSize - writePos;
+ ssize_t num = (count <= remain) ? count : remain;
+ unsigned char * p = (unsigned char *)writeBuf;
+ p += writePos;
+
+ memcpy(p, buf, num);
+ writePos += num;
+ return num;
+ }
+ return 0;
+}
+
+void qdMock_resetWriteBuf(ssize_t size)
+{
+ writePos = 0;
+
+ if (writeBufSize == size) {
+ return;
+ }
+
+ if (NULL != writeBuf) {
+ free(writeBuf);
+ }
+
+ writeBuf = malloc(size);
+ assert(NULL != writeBuf);
+ writeBufSize = size;
+}
+
+ssize_t qdMock_getNumBytesWritten()
+{
+ return writePos;
+}
+
+const void * qdMock_getBytesWritten()
+{
+ return writeBuf;
+}
+
+
--- /dev/null
+/*
+ * QuanDocs mock I/O routines for unit testing.
+ *
+ * Copyright (C) 2015 Chris Jaekl
+ */
+
+#ifndef __QD_MOCK_IO_H__
+#define __QD_MOCK_IO_H__
+
+ssize_t qdMock_read(int fd, void *buf, size_t count);
+ssize_t qdMock_write(int fd, void *buf, size_t count);
+
+void qdMock_resetReadBytes(void *buf, size_t count);
+ssize_t qdMock_getNumBytesRead();
+
+void qdMock_resetWriteBuf(ssize_t size);
+ssize_t qdMock_getNumBytesWritten();
+const void * qdMock_getBytesWritten();
+
+#endif /* __QD_MOCK_IO_H__ */
+
--- /dev/null
+/*
+ * Copyright (C) 2015 Chris Jaekl
+ */
+
+void qdAbort_impl(const char * die_msg, long die_retCode, const char *file, const char *line)
+{
+ // no-op
+}
+
+
--- /dev/null
+
+#ifndef __QD_TESTCASE_H__
+#define __QD_TESTCASE_H__
+
+#include "unity.h"
+
+void setUp(void);
+void tearDown(void);
+
+static void runTest(UnityTestFunction test)
+{
+ if (TEST_PROTECT())
+ {
+ setUp();
+ test();
+ }
+ if (TEST_PROTECT() && !TEST_IS_IGNORED)
+ {
+ tearDown();
+ }
+}
+void resetTest(void);
+void resetTest(void)
+{
+ tearDown();
+ setUp();
+}
+
+#endif /* __QD_TESTCASE_H__ */
+
--- /dev/null
+/*
+ * Test for qdsocket.c
+ *
+ * Copyright (C) 2015 Chris Jaekl
+ */
+
+#include <string.h>
+
+#include "qdtestcase.h"
+
+#include "mock_io.h"
+#include "qdsocket.h"
+#include "qdtypes.h"
+
+void setUp(void)
+{
+ //This is run before EACH TEST
+}
+
+void tearDown(void)
+{
+}
+
+void test_qdSockInit(void)
+{
+ struct qdSocket sock;
+
+ qdSockInit(&sock);
+
+ TEST_ASSERT_EQUAL(0, sock.sd);
+ TEST_ASSERT_EQUAL(0, sock.toWrite);
+ TEST_ASSERT_EQUAL(FALSE, sock.closeRequested);
+}
+
+void test_qdSockWrite_socketBusy(void)
+{
+ ssize_t ret;
+ struct qdSocket sock;
+ char buf[32];
+
+ memset(buf, 'A', 32);
+
+ qdSockInit(&sock);
+
+ qdMock_resetWriteBuf(0);
+
+ ret = qdSockWrite(&sock, buf, 32);
+
+ TEST_ASSERT_EQUAL(0, ret);
+ TEST_ASSERT_EQUAL(32, sock.toWrite);
+ TEST_ASSERT_EQUAL(FALSE, sock.closeRequested);
+ TEST_ASSERT_EQUAL(0, memcmp(buf, sock.buf, 32));
+
+ TEST_ASSERT_EQUAL(0, qdMock_getNumBytesWritten());
+}
+
+void test_qdSockWrite_partWritten(void)
+{
+ ssize_t ret;
+ struct qdSocket sock;
+ char buf[32];
+
+ memcpy(buf, "abcdefghijklmnopqrstuvwxyz789012", 32);
+
+ qdSockInit(&sock);
+
+ qdMock_resetWriteBuf(17);
+
+ ret = qdSockWrite(&sock, buf, 32);
+
+ TEST_ASSERT_EQUAL(17, ret);
+ TEST_ASSERT_EQUAL(15, sock.toWrite);
+ TEST_ASSERT_EQUAL(FALSE, sock.closeRequested);
+ TEST_ASSERT_EQUAL(0, memcmp(buf + 17, sock.buf, 15));
+
+ TEST_ASSERT_EQUAL(17, qdMock_getNumBytesWritten());
+ TEST_ASSERT_EQUAL(0, memcmp(buf, qdMock_getBytesWritten(), 17));
+
+ qdMock_resetWriteBuf(17);
+
+ ret = qdSockFlush(&sock);
+
+ TEST_ASSERT_EQUAL(15, ret);
+ TEST_ASSERT_EQUAL(0, sock.toWrite);
+ TEST_ASSERT_EQUAL(FALSE, sock.closeRequested);
+
+ TEST_ASSERT_EQUAL(15, qdMock_getNumBytesWritten());
+ TEST_ASSERT_EQUAL(0, memcmp(buf + 17, qdMock_getBytesWritten(), 15));
+}
+
+#define WWVB_SIZE 33
+void test_qdSockWrite_writeWithVariedBuffering(void)
+{
+ ssize_t ret;
+ struct qdSocket sock;
+ char buf[WWVB_SIZE];
+ const char * expected;
+ const char * actual;
+ int chunkSize;
+
+ memcpy(buf, "abcdefghijklmnopqrstuvwxyz7890123", WWVB_SIZE);
+
+ // Constrain socket writes to chunkSize bytes at a time.
+ // Try various different chunk sizes, and confirm that the
+ // whole write eventually succeeds, after enough calls to
+ // qdSockFlush().
+ //
+ for (chunkSize = 1; chunkSize <= (WWVB_SIZE + 1); ++chunkSize) {
+ qdSockInit(&sock);
+ qdMock_resetWriteBuf(chunkSize);
+
+ expected = &(buf[0]);
+ ret = qdSockWrite(&sock, buf, WWVB_SIZE);
+
+ while (ret > 0) {
+ actual = qdMock_getBytesWritten();
+ while (ret > 0) {
+ TEST_ASSERT_EQUAL(*expected, *actual);
+ ++expected;
+ ++actual;
+ --ret;
+ }
+
+ qdMock_resetWriteBuf(chunkSize);
+ ret = qdSockFlush(&sock);
+ }
+ }
+}
+
+
+// TODO: need a lot more tests here
+
+int main(void)
+{
+ UnityBegin("test_qdsocket.c");
+
+ // RUN_TEST calls runTest
+ RUN_TEST(test_qdSockInit);
+ RUN_TEST(test_qdSockWrite_socketBusy);
+ RUN_TEST(test_qdSockWrite_partWritten);
+ RUN_TEST(test_qdSockWrite_writeWithVariedBuffering);
+
+ UnityEnd();
+ return 0;
+}
--- /dev/null
+The files in this directory are from
+
+ http://throwtheswitch.org/
+
+written by Mike Karlesky, Mark Vandervoord, and Greg Williams,
+
+See docs/license.txt.
+
--- /dev/null
+ Copyright (c) 2007-2010 Mike Karlesky, Mark VanderVoord, Greg Williams\r
+\r
+ Permission is hereby granted, free of charge, to any person\r
+ obtaining a copy of this software and associated documentation\r
+ files (the "Software"), to deal in the Software without\r
+ restriction, including without limitation the rights to use,\r
+ copy, modify, merge, publish, distribute, sublicense, and/or sell\r
+ copies of the Software, and to permit persons to whom the\r
+ Software is furnished to do so, subject to the following\r
+ conditions:\r
+\r
+ The above copyright notice and this permission notice shall be\r
+ included in all copies or substantial portions of the Software.\r
+\r
+ The end-user documentation included with the redistribution, if \r
+ any, must include the following acknowledgment: "This product \r
+ includes software developed for the Unity Project, by Mike Karlesky,\r
+ Mark VanderVoord, and Greg Williams and other contributors", in \r
+ the same place and form as other third-party acknowledgments. \r
+ Alternately, this acknowledgment may appear in the software \r
+ itself, in the same form and location as other such third-party \r
+ acknowledgments.\r
+ \r
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES\r
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\r
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,\r
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\r
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR\r
+ OTHER DEALINGS IN THE SOFTWARE.
\ No newline at end of file
--- /dev/null
+/* =========================================================================\r
+ Unity Project - A Test Framework for C\r
+ Copyright (c) 2007-14 Mike Karlesky, Mark VanderVoord, Greg Williams\r
+ [Released under MIT License. Please refer to license.txt for details]\r
+============================================================================ */\r
+\r
+#include "unity.h"\r
+\r
+#define UNITY_FAIL_AND_BAIL { Unity.CurrentTestFailed = 1; longjmp(Unity.AbortFrame, 1); }\r
+#define UNITY_IGNORE_AND_BAIL { Unity.CurrentTestIgnored = 1; longjmp(Unity.AbortFrame, 1); }\r
+/// return prematurely if we are already in failure or ignore state\r
+#define UNITY_SKIP_EXECUTION { if ((Unity.CurrentTestFailed != 0) || (Unity.CurrentTestIgnored != 0)) {return;} }\r
+#define UNITY_PRINT_EOL { UNITY_OUTPUT_CHAR('\n'); }\r
+\r
+struct _Unity Unity;\r
+\r
+const char UnityStrOk[] = "OK";\r
+const char UnityStrPass[] = "PASS";\r
+const char UnityStrFail[] = "FAIL";\r
+const char UnityStrIgnore[] = "IGNORE";\r
+const char UnityStrNull[] = "NULL";\r
+const char UnityStrSpacer[] = ". ";\r
+const char UnityStrExpected[] = " Expected ";\r
+const char UnityStrWas[] = " Was ";\r
+const char UnityStrTo[] = " To ";\r
+const char UnityStrElement[] = " Element ";\r
+const char UnityStrByte[] = " Byte ";\r
+const char UnityStrMemory[] = " Memory Mismatch.";\r
+const char UnityStrDelta[] = " Values Not Within Delta ";\r
+const char UnityStrPointless[] = " You Asked Me To Compare Nothing, Which Was Pointless.";\r
+const char UnityStrNullPointerForExpected[] = " Expected pointer to be NULL";\r
+const char UnityStrNullPointerForActual[] = " Actual pointer was NULL";\r
+const char UnityStrNot[] = "Not ";\r
+const char UnityStrInf[] = "Infinity";\r
+const char UnityStrNegInf[] = "Negative Infinity";\r
+const char UnityStrNaN[] = "NaN";\r
+const char UnityStrDet[] = "Determinate";\r
+const char UnityStrErrFloat[] = "Unity Floating Point Disabled";\r
+const char UnityStrErrDouble[] = "Unity Double Precision Disabled";\r
+const char UnityStrErr64[] = "Unity 64-bit Support Disabled";\r
+const char UnityStrBreaker[] = "-----------------------";\r
+const char UnityStrResultsTests[] = " Tests ";\r
+const char UnityStrResultsFailures[] = " Failures ";\r
+const char UnityStrResultsIgnored[] = " Ignored ";\r
+\r
+#ifndef UNITY_EXCLUDE_FLOAT\r
+// Dividing by these constants produces +/- infinity.\r
+// The rationale is given in UnityAssertFloatIsInf's body.\r
+static const _UF f_zero = 0.0f;\r
+#ifndef UNITY_EXCLUDE_DOUBLE\r
+static const _UD d_zero = 0.0;\r
+#endif\r
+#endif\r
+\r
+// compiler-generic print formatting masks\r
+const _U_UINT UnitySizeMask[] =\r
+{\r
+ 255u, // 0xFF\r
+ 65535u, // 0xFFFF\r
+ 65535u,\r
+ 4294967295u, // 0xFFFFFFFF\r
+ 4294967295u,\r
+ 4294967295u,\r
+ 4294967295u\r
+#ifdef UNITY_SUPPORT_64\r
+ ,0xFFFFFFFFFFFFFFFF\r
+#endif\r
+};\r
+\r
+void UnityPrintFail(void);\r
+void UnityPrintOk(void);\r
+\r
+//-----------------------------------------------\r
+// Pretty Printers & Test Result Output Handlers\r
+//-----------------------------------------------\r
+\r
+void UnityPrint(const char* string)\r
+{\r
+ const char* pch = string;\r
+\r
+ if (pch != NULL)\r
+ {\r
+ while (*pch)\r
+ {\r
+ // printable characters plus CR & LF are printed\r
+ if ((*pch <= 126) && (*pch >= 32))\r
+ {\r
+ UNITY_OUTPUT_CHAR(*pch);\r
+ }\r
+ //write escaped carriage returns\r
+ else if (*pch == 13)\r
+ {\r
+ UNITY_OUTPUT_CHAR('\\');\r
+ UNITY_OUTPUT_CHAR('r');\r
+ }\r
+ //write escaped line feeds\r
+ else if (*pch == 10)\r
+ {\r
+ UNITY_OUTPUT_CHAR('\\');\r
+ UNITY_OUTPUT_CHAR('n');\r
+ }\r
+ // unprintable characters are shown as codes\r
+ else\r
+ {\r
+ UNITY_OUTPUT_CHAR('\\');\r
+ UnityPrintNumberHex((_U_UINT)*pch, 2);\r
+ }\r
+ pch++;\r
+ }\r
+ }\r
+}\r
+\r
+//-----------------------------------------------\r
+void UnityPrintNumberByStyle(const _U_SINT number, const UNITY_DISPLAY_STYLE_T style)\r
+{\r
+ if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT)\r
+ {\r
+ UnityPrintNumber(number);\r
+ }\r
+ else if ((style & UNITY_DISPLAY_RANGE_UINT) == UNITY_DISPLAY_RANGE_UINT)\r
+ {\r
+ UnityPrintNumberUnsigned( (_U_UINT)number & UnitySizeMask[((_U_UINT)style & (_U_UINT)0x0F) - 1] );\r
+ }\r
+ else\r
+ {\r
+ UnityPrintNumberHex((_U_UINT)number, (char)((style & 0x000F) << 1));\r
+ }\r
+}\r
+\r
+//-----------------------------------------------\r
+/// basically do an itoa using as little ram as possible\r
+void UnityPrintNumber(const _U_SINT number_to_print)\r
+{\r
+ _U_SINT divisor = 1;\r
+ _U_SINT next_divisor;\r
+ _U_UINT number;\r
+\r
+ if (number_to_print == (1l << (UNITY_LONG_WIDTH-1)))\r
+ {\r
+ //The largest representable negative number\r
+ UNITY_OUTPUT_CHAR('-');\r
+ number = (1ul << (UNITY_LONG_WIDTH-1));\r
+ }\r
+ else if (number_to_print < 0)\r
+ {\r
+ //Some other negative number\r
+ UNITY_OUTPUT_CHAR('-');\r
+ number = (_U_UINT)(-number_to_print);\r
+ }\r
+ else\r
+ {\r
+ //Positive number\r
+ number = (_U_UINT)number_to_print;\r
+ }\r
+\r
+ // figure out initial divisor\r
+ while (number / divisor > 9)\r
+ {\r
+ next_divisor = divisor * 10;\r
+ if (next_divisor > divisor)\r
+ divisor = next_divisor;\r
+ else\r
+ break;\r
+ }\r
+\r
+ // now mod and print, then divide divisor\r
+ do\r
+ {\r
+ UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10)));\r
+ divisor /= 10;\r
+ }\r
+ while (divisor > 0);\r
+}\r
+\r
+//-----------------------------------------------\r
+/// basically do an itoa using as little ram as possible\r
+void UnityPrintNumberUnsigned(const _U_UINT number)\r
+{\r
+ _U_UINT divisor = 1;\r
+ _U_UINT next_divisor;\r
+\r
+ // figure out initial divisor\r
+ while (number / divisor > 9)\r
+ {\r
+ next_divisor = divisor * 10;\r
+ if (next_divisor > divisor)\r
+ divisor = next_divisor;\r
+ else\r
+ break;\r
+ }\r
+\r
+ // now mod and print, then divide divisor\r
+ do\r
+ {\r
+ UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10)));\r
+ divisor /= 10;\r
+ }\r
+ while (divisor > 0);\r
+}\r
+\r
+//-----------------------------------------------\r
+void UnityPrintNumberHex(const _U_UINT number, const char nibbles_to_print)\r
+{\r
+ _U_UINT nibble;\r
+ char nibbles = nibbles_to_print;\r
+ UNITY_OUTPUT_CHAR('0');\r
+ UNITY_OUTPUT_CHAR('x');\r
+\r
+ while (nibbles > 0)\r
+ {\r
+ nibble = (number >> (--nibbles << 2)) & 0x0000000F;\r
+ if (nibble <= 9)\r
+ {\r
+ UNITY_OUTPUT_CHAR((char)('0' + nibble));\r
+ }\r
+ else\r
+ {\r
+ UNITY_OUTPUT_CHAR((char)('A' - 10 + nibble));\r
+ }\r
+ }\r
+}\r
+\r
+//-----------------------------------------------\r
+void UnityPrintMask(const _U_UINT mask, const _U_UINT number)\r
+{\r
+ _U_UINT current_bit = (_U_UINT)1 << (UNITY_INT_WIDTH - 1);\r
+ _US32 i;\r
+\r
+ for (i = 0; i < UNITY_INT_WIDTH; i++)\r
+ {\r
+ if (current_bit & mask)\r
+ {\r
+ if (current_bit & number)\r
+ {\r
+ UNITY_OUTPUT_CHAR('1');\r
+ }\r
+ else\r
+ {\r
+ UNITY_OUTPUT_CHAR('0');\r
+ }\r
+ }\r
+ else\r
+ {\r
+ UNITY_OUTPUT_CHAR('X');\r
+ }\r
+ current_bit = current_bit >> 1;\r
+ }\r
+}\r
+\r
+//-----------------------------------------------\r
+#ifdef UNITY_FLOAT_VERBOSE\r
+#include <string.h>\r
+void UnityPrintFloat(_UF number)\r
+{\r
+ char TempBuffer[32];\r
+ sprintf(TempBuffer, "%.6f", number);\r
+ UnityPrint(TempBuffer);\r
+}\r
+#endif\r
+\r
+//-----------------------------------------------\r
+\r
+void UnityPrintFail(void)\r
+{\r
+ UnityPrint(UnityStrFail);\r
+}\r
+\r
+void UnityPrintOk(void)\r
+{\r
+ UnityPrint(UnityStrOk);\r
+}\r
+\r
+//-----------------------------------------------\r
+void UnityTestResultsBegin(const char* file, const UNITY_LINE_TYPE line)\r
+{\r
+ UNITY_PRINT_EOL;\r
+ UnityPrint(file);\r
+ UNITY_OUTPUT_CHAR(':');\r
+ UnityPrintNumber((_U_SINT)line);\r
+ UNITY_OUTPUT_CHAR(':');\r
+ UnityPrint(Unity.CurrentTestName);\r
+ UNITY_OUTPUT_CHAR(':');\r
+}\r
+\r
+//-----------------------------------------------\r
+void UnityTestResultsFailBegin(const UNITY_LINE_TYPE line)\r
+{\r
+ UnityTestResultsBegin(Unity.TestFile, line);\r
+ UnityPrint(UnityStrFail);\r
+ UNITY_OUTPUT_CHAR(':');\r
+}\r
+\r
+//-----------------------------------------------\r
+void UnityConcludeTest(void)\r
+{\r
+ if (Unity.CurrentTestIgnored)\r
+ {\r
+ Unity.TestIgnores++;\r
+ }\r
+ else if (!Unity.CurrentTestFailed)\r
+ {\r
+ UnityTestResultsBegin(Unity.TestFile, Unity.CurrentTestLineNumber);\r
+ UnityPrint(UnityStrPass);\r
+ }\r
+ else\r
+ {\r
+ Unity.TestFailures++;\r
+ }\r
+\r
+ Unity.CurrentTestFailed = 0;\r
+ Unity.CurrentTestIgnored = 0;\r
+}\r
+\r
+//-----------------------------------------------\r
+void UnityAddMsgIfSpecified(const char* msg)\r
+{\r
+ if (msg)\r
+ {\r
+ UnityPrint(UnityStrSpacer);\r
+ UnityPrint(msg);\r
+ }\r
+}\r
+\r
+//-----------------------------------------------\r
+void UnityPrintExpectedAndActualStrings(const char* expected, const char* actual)\r
+{\r
+ UnityPrint(UnityStrExpected);\r
+ if (expected != NULL)\r
+ {\r
+ UNITY_OUTPUT_CHAR('\'');\r
+ UnityPrint(expected);\r
+ UNITY_OUTPUT_CHAR('\'');\r
+ }\r
+ else\r
+ {\r
+ UnityPrint(UnityStrNull);\r
+ }\r
+ UnityPrint(UnityStrWas);\r
+ if (actual != NULL)\r
+ {\r
+ UNITY_OUTPUT_CHAR('\'');\r
+ UnityPrint(actual);\r
+ UNITY_OUTPUT_CHAR('\'');\r
+ }\r
+ else\r
+ {\r
+ UnityPrint(UnityStrNull);\r
+ }\r
+}\r
+\r
+//-----------------------------------------------\r
+// Assertion & Control Helpers\r
+//-----------------------------------------------\r
+\r
+int UnityCheckArraysForNull(UNITY_PTR_ATTRIBUTE const void* expected, UNITY_PTR_ATTRIBUTE const void* actual, const UNITY_LINE_TYPE lineNumber, const char* msg)\r
+{\r
+ //return true if they are both NULL\r
+ if ((expected == NULL) && (actual == NULL))\r
+ return 1;\r
+\r
+ //throw error if just expected is NULL\r
+ if (expected == NULL)\r
+ {\r
+ UnityTestResultsFailBegin(lineNumber);\r
+ UnityPrint(UnityStrNullPointerForExpected);\r
+ UnityAddMsgIfSpecified(msg);\r
+ UNITY_FAIL_AND_BAIL;\r
+ }\r
+\r
+ //throw error if just actual is NULL\r
+ if (actual == NULL)\r
+ {\r
+ UnityTestResultsFailBegin(lineNumber);\r
+ UnityPrint(UnityStrNullPointerForActual);\r
+ UnityAddMsgIfSpecified(msg);\r
+ UNITY_FAIL_AND_BAIL;\r
+ }\r
+\r
+ //return false if neither is NULL\r
+ return 0;\r
+}\r
+\r
+//-----------------------------------------------\r
+// Assertion Functions\r
+//-----------------------------------------------\r
+\r
+void UnityAssertBits(const _U_SINT mask,\r
+ const _U_SINT expected,\r
+ const _U_SINT actual,\r
+ const char* msg,\r
+ const UNITY_LINE_TYPE lineNumber)\r
+{\r
+ UNITY_SKIP_EXECUTION;\r
+\r
+ if ((mask & expected) != (mask & actual))\r
+ {\r
+ UnityTestResultsFailBegin(lineNumber);\r
+ UnityPrint(UnityStrExpected);\r
+ UnityPrintMask((_U_UINT)mask, (_U_UINT)expected);\r
+ UnityPrint(UnityStrWas);\r
+ UnityPrintMask((_U_UINT)mask, (_U_UINT)actual);\r
+ UnityAddMsgIfSpecified(msg);\r
+ UNITY_FAIL_AND_BAIL;\r
+ }\r
+}\r
+\r
+//-----------------------------------------------\r
+void UnityAssertEqualNumber(const _U_SINT expected,\r
+ const _U_SINT actual,\r
+ const char* msg,\r
+ const UNITY_LINE_TYPE lineNumber,\r
+ const UNITY_DISPLAY_STYLE_T style)\r
+{\r
+ UNITY_SKIP_EXECUTION;\r
+\r
+ if (expected != actual)\r
+ {\r
+ UnityTestResultsFailBegin(lineNumber);\r
+ UnityPrint(UnityStrExpected);\r
+ UnityPrintNumberByStyle(expected, style);\r
+ UnityPrint(UnityStrWas);\r
+ UnityPrintNumberByStyle(actual, style);\r
+ UnityAddMsgIfSpecified(msg);\r
+ UNITY_FAIL_AND_BAIL;\r
+ }\r
+}\r
+\r
+//-----------------------------------------------\r
+void UnityAssertEqualIntArray(UNITY_PTR_ATTRIBUTE const void* expected,\r
+ UNITY_PTR_ATTRIBUTE const void* actual,\r
+ const _UU32 num_elements,\r
+ const char* msg,\r
+ const UNITY_LINE_TYPE lineNumber,\r
+ const UNITY_DISPLAY_STYLE_T style)\r
+{\r
+ _UU32 elements = num_elements;\r
+ UNITY_PTR_ATTRIBUTE const _US8* ptr_exp = (UNITY_PTR_ATTRIBUTE const _US8*)expected;\r
+ UNITY_PTR_ATTRIBUTE const _US8* ptr_act = (UNITY_PTR_ATTRIBUTE const _US8*)actual;\r
+\r
+ UNITY_SKIP_EXECUTION;\r
+\r
+ if (elements == 0)\r
+ {\r
+ UnityTestResultsFailBegin(lineNumber);\r
+ UnityPrint(UnityStrPointless);\r
+ UnityAddMsgIfSpecified(msg);\r
+ UNITY_FAIL_AND_BAIL;\r
+ }\r
+\r
+ if (UnityCheckArraysForNull((UNITY_PTR_ATTRIBUTE const void*)expected, (UNITY_PTR_ATTRIBUTE const void*)actual, lineNumber, msg) == 1)\r
+ return;\r
+\r
+ // If style is UNITY_DISPLAY_STYLE_INT, we'll fall into the default case rather than the INT16 or INT32 (etc) case\r
+ // as UNITY_DISPLAY_STYLE_INT includes a flag for UNITY_DISPLAY_RANGE_AUTO, which the width-specific\r
+ // variants do not. Therefore remove this flag.\r
+ switch(style & (UNITY_DISPLAY_STYLE_T)(~UNITY_DISPLAY_RANGE_AUTO))\r
+ {\r
+ case UNITY_DISPLAY_STYLE_HEX8:\r
+ case UNITY_DISPLAY_STYLE_INT8:\r
+ case UNITY_DISPLAY_STYLE_UINT8:\r
+ while (elements--)\r
+ {\r
+ if (*ptr_exp != *ptr_act)\r
+ {\r
+ UnityTestResultsFailBegin(lineNumber);\r
+ UnityPrint(UnityStrElement);\r
+ UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);\r
+ UnityPrint(UnityStrExpected);\r
+ UnityPrintNumberByStyle(*ptr_exp, style);\r
+ UnityPrint(UnityStrWas);\r
+ UnityPrintNumberByStyle(*ptr_act, style);\r
+ UnityAddMsgIfSpecified(msg);\r
+ UNITY_FAIL_AND_BAIL;\r
+ }\r
+ ptr_exp += 1;\r
+ ptr_act += 1;\r
+ }\r
+ break;\r
+ case UNITY_DISPLAY_STYLE_HEX16:\r
+ case UNITY_DISPLAY_STYLE_INT16:\r
+ case UNITY_DISPLAY_STYLE_UINT16:\r
+ while (elements--)\r
+ {\r
+ if (*(UNITY_PTR_ATTRIBUTE const _US16*)ptr_exp != *(UNITY_PTR_ATTRIBUTE const _US16*)ptr_act)\r
+ {\r
+ UnityTestResultsFailBegin(lineNumber);\r
+ UnityPrint(UnityStrElement);\r
+ UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);\r
+ UnityPrint(UnityStrExpected);\r
+ UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US16*)ptr_exp, style);\r
+ UnityPrint(UnityStrWas);\r
+ UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US16*)ptr_act, style);\r
+ UnityAddMsgIfSpecified(msg);\r
+ UNITY_FAIL_AND_BAIL;\r
+ }\r
+ ptr_exp += 2;\r
+ ptr_act += 2;\r
+ }\r
+ break;\r
+#ifdef UNITY_SUPPORT_64\r
+ case UNITY_DISPLAY_STYLE_HEX64:\r
+ case UNITY_DISPLAY_STYLE_INT64:\r
+ case UNITY_DISPLAY_STYLE_UINT64:\r
+ while (elements--)\r
+ {\r
+ if (*(UNITY_PTR_ATTRIBUTE const _US64*)ptr_exp != *(UNITY_PTR_ATTRIBUTE const _US64*)ptr_act)\r
+ {\r
+ UnityTestResultsFailBegin(lineNumber);\r
+ UnityPrint(UnityStrElement);\r
+ UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);\r
+ UnityPrint(UnityStrExpected);\r
+ UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US64*)ptr_exp, style);\r
+ UnityPrint(UnityStrWas);\r
+ UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US64*)ptr_act, style);\r
+ UnityAddMsgIfSpecified(msg);\r
+ UNITY_FAIL_AND_BAIL;\r
+ }\r
+ ptr_exp += 8;\r
+ ptr_act += 8;\r
+ }\r
+ break;\r
+#endif\r
+ default:\r
+ while (elements--)\r
+ {\r
+ if (*(UNITY_PTR_ATTRIBUTE const _US32*)ptr_exp != *(UNITY_PTR_ATTRIBUTE const _US32*)ptr_act)\r
+ {\r
+ UnityTestResultsFailBegin(lineNumber);\r
+ UnityPrint(UnityStrElement);\r
+ UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);\r
+ UnityPrint(UnityStrExpected);\r
+ UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US32*)ptr_exp, style);\r
+ UnityPrint(UnityStrWas);\r
+ UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US32*)ptr_act, style);\r
+ UnityAddMsgIfSpecified(msg);\r
+ UNITY_FAIL_AND_BAIL;\r
+ }\r
+ ptr_exp += 4;\r
+ ptr_act += 4;\r
+ }\r
+ break;\r
+ }\r
+}\r
+\r
+//-----------------------------------------------\r
+#ifndef UNITY_EXCLUDE_FLOAT\r
+void UnityAssertEqualFloatArray(UNITY_PTR_ATTRIBUTE const _UF* expected,\r
+ UNITY_PTR_ATTRIBUTE const _UF* actual,\r
+ const _UU32 num_elements,\r
+ const char* msg,\r
+ const UNITY_LINE_TYPE lineNumber)\r
+{\r
+ _UU32 elements = num_elements;\r
+ UNITY_PTR_ATTRIBUTE const _UF* ptr_expected = expected;\r
+ UNITY_PTR_ATTRIBUTE const _UF* ptr_actual = actual;\r
+ _UF diff, tol;\r
+\r
+ UNITY_SKIP_EXECUTION;\r
+\r
+ if (elements == 0)\r
+ {\r
+ UnityTestResultsFailBegin(lineNumber);\r
+ UnityPrint(UnityStrPointless);\r
+ UnityAddMsgIfSpecified(msg);\r
+ UNITY_FAIL_AND_BAIL;\r
+ }\r
+\r
+ if (UnityCheckArraysForNull((UNITY_PTR_ATTRIBUTE const void*)expected, (UNITY_PTR_ATTRIBUTE const void*)actual, lineNumber, msg) == 1)\r
+ return;\r
+\r
+ while (elements--)\r
+ {\r
+ diff = *ptr_expected - *ptr_actual;\r
+ if (diff < 0.0f)\r
+ diff = 0.0f - diff;\r
+ tol = UNITY_FLOAT_PRECISION * *ptr_expected;\r
+ if (tol < 0.0f)\r
+ tol = 0.0f - tol;\r
+\r
+ //This first part of this condition will catch any NaN or Infinite values\r
+ if ((diff * 0.0f != 0.0f) || (diff > tol))\r
+ {\r
+ UnityTestResultsFailBegin(lineNumber);\r
+ UnityPrint(UnityStrElement);\r
+ UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);\r
+#ifdef UNITY_FLOAT_VERBOSE\r
+ UnityPrint(UnityStrExpected);\r
+ UnityPrintFloat(*ptr_expected);\r
+ UnityPrint(UnityStrWas);\r
+ UnityPrintFloat(*ptr_actual);\r
+#else\r
+ UnityPrint(UnityStrDelta);\r
+#endif\r
+ UnityAddMsgIfSpecified(msg);\r
+ UNITY_FAIL_AND_BAIL;\r
+ }\r
+ ptr_expected++;\r
+ ptr_actual++;\r
+ }\r
+}\r
+\r
+//-----------------------------------------------\r
+void UnityAssertFloatsWithin(const _UF delta,\r
+ const _UF expected,\r
+ const _UF actual,\r
+ const char* msg,\r
+ const UNITY_LINE_TYPE lineNumber)\r
+{\r
+ _UF diff = actual - expected;\r
+ _UF pos_delta = delta;\r
+\r
+ UNITY_SKIP_EXECUTION;\r
+\r
+ if (diff < 0.0f)\r
+ {\r
+ diff = 0.0f - diff;\r
+ }\r
+ if (pos_delta < 0.0f)\r
+ {\r
+ pos_delta = 0.0f - pos_delta;\r
+ }\r
+\r
+ //This first part of this condition will catch any NaN or Infinite values\r
+ if ((diff * 0.0f != 0.0f) || (pos_delta < diff))\r
+ {\r
+ UnityTestResultsFailBegin(lineNumber);\r
+#ifdef UNITY_FLOAT_VERBOSE\r
+ UnityPrint(UnityStrExpected);\r
+ UnityPrintFloat(expected);\r
+ UnityPrint(UnityStrWas);\r
+ UnityPrintFloat(actual);\r
+#else\r
+ UnityPrint(UnityStrDelta);\r
+#endif\r
+ UnityAddMsgIfSpecified(msg);\r
+ UNITY_FAIL_AND_BAIL;\r
+ }\r
+}\r
+\r
+//-----------------------------------------------\r
+void UnityAssertFloatSpecial(const _UF actual,\r
+ const char* msg,\r
+ const UNITY_LINE_TYPE lineNumber,\r
+ const UNITY_FLOAT_TRAIT_T style)\r
+{\r
+ UNITY_SKIP_EXECUTION;\r
+\r
+ const char* trait_names[] = { UnityStrInf, UnityStrNegInf, UnityStrNaN, UnityStrDet };\r
+ _U_SINT should_be_trait = ((_U_SINT)style & 1);\r
+ _U_SINT is_trait = !should_be_trait;\r
+ _U_SINT trait_index = style >> 1;\r
+\r
+ switch(style)\r
+ {\r
+ //To determine Inf / Neg Inf, we compare to an Inf / Neg Inf value we create on the fly\r
+ //We are using a variable to hold the zero value because some compilers complain about dividing by zero otherwise\r
+ case UNITY_FLOAT_IS_INF:\r
+ case UNITY_FLOAT_IS_NOT_INF:\r
+ is_trait = ((1.0f / f_zero) == actual) ? 1 : 0;\r
+ break;\r
+ case UNITY_FLOAT_IS_NEG_INF:\r
+ case UNITY_FLOAT_IS_NOT_NEG_INF:\r
+ is_trait = ((-1.0f / f_zero) == actual) ? 1 : 0;\r
+ break;\r
+\r
+ //NaN is the only floating point value that does NOT equal itself. Therefore if Actual == Actual, then it is NOT NaN.\r
+ case UNITY_FLOAT_IS_NAN:\r
+ case UNITY_FLOAT_IS_NOT_NAN:\r
+ is_trait = (actual == actual) ? 0 : 1;\r
+ break;\r
+\r
+ //A determinate number is non infinite and not NaN. (therefore the opposite of the two above)\r
+ case UNITY_FLOAT_IS_DET:\r
+ case UNITY_FLOAT_IS_NOT_DET:\r
+ if ( (actual != actual) || ((1.0f / f_zero) == actual) || ((-1.0f / f_zero) == actual) )\r
+ is_trait = 0;\r
+ else\r
+ is_trait = 1;\r
+ break;\r
+ }\r
+\r
+ if (is_trait != should_be_trait)\r
+ {\r
+ UnityTestResultsFailBegin(lineNumber);\r
+ UnityPrint(UnityStrExpected);\r
+ if (!should_be_trait)\r
+ UnityPrint(UnityStrNot);\r
+ UnityPrint(trait_names[trait_index]);\r
+ UnityPrint(UnityStrWas);\r
+#ifdef UNITY_FLOAT_VERBOSE\r
+ UnityPrintFloat(actual);\r
+#else\r
+ if (should_be_trait)\r
+ UnityPrint(UnityStrNot);\r
+ UnityPrint(trait_names[trait_index]);\r
+#endif\r
+ UnityAddMsgIfSpecified(msg);\r
+ UNITY_FAIL_AND_BAIL;\r
+ }\r
+}\r
+\r
+#endif //not UNITY_EXCLUDE_FLOAT\r
+\r
+//-----------------------------------------------\r
+#ifndef UNITY_EXCLUDE_DOUBLE\r
+void UnityAssertEqualDoubleArray(UNITY_PTR_ATTRIBUTE const _UD* expected,\r
+ UNITY_PTR_ATTRIBUTE const _UD* actual,\r
+ const _UU32 num_elements,\r
+ const char* msg,\r
+ const UNITY_LINE_TYPE lineNumber)\r
+{\r
+ _UU32 elements = num_elements;\r
+ UNITY_PTR_ATTRIBUTE const _UD* ptr_expected = expected;\r
+ UNITY_PTR_ATTRIBUTE const _UD* ptr_actual = actual;\r
+ _UD diff, tol;\r
+\r
+ UNITY_SKIP_EXECUTION;\r
+\r
+ if (elements == 0)\r
+ {\r
+ UnityTestResultsFailBegin(lineNumber);\r
+ UnityPrint(UnityStrPointless);\r
+ UnityAddMsgIfSpecified(msg);\r
+ UNITY_FAIL_AND_BAIL;\r
+ }\r
+\r
+ if (UnityCheckArraysForNull((UNITY_PTR_ATTRIBUTE void*)expected, (UNITY_PTR_ATTRIBUTE void*)actual, lineNumber, msg) == 1)\r
+ return;\r
+\r
+ while (elements--)\r
+ {\r
+ diff = *ptr_expected - *ptr_actual;\r
+ if (diff < 0.0)\r
+ diff = 0.0 - diff;\r
+ tol = UNITY_DOUBLE_PRECISION * *ptr_expected;\r
+ if (tol < 0.0)\r
+ tol = 0.0 - tol;\r
+\r
+ //This first part of this condition will catch any NaN or Infinite values\r
+ if ((diff * 0.0 != 0.0) || (diff > tol))\r
+ {\r
+ UnityTestResultsFailBegin(lineNumber);\r
+ UnityPrint(UnityStrElement);\r
+ UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);\r
+#ifdef UNITY_DOUBLE_VERBOSE\r
+ UnityPrint(UnityStrExpected);\r
+ UnityPrintFloat((float)(*ptr_expected));\r
+ UnityPrint(UnityStrWas);\r
+ UnityPrintFloat((float)(*ptr_actual));\r
+#else\r
+ UnityPrint(UnityStrDelta);\r
+#endif\r
+ UnityAddMsgIfSpecified(msg);\r
+ UNITY_FAIL_AND_BAIL;\r
+ }\r
+ ptr_expected++;\r
+ ptr_actual++;\r
+ }\r
+}\r
+\r
+//-----------------------------------------------\r
+void UnityAssertDoublesWithin(const _UD delta,\r
+ const _UD expected,\r
+ const _UD actual,\r
+ const char* msg,\r
+ const UNITY_LINE_TYPE lineNumber)\r
+{\r
+ _UD diff = actual - expected;\r
+ _UD pos_delta = delta;\r
+\r
+ UNITY_SKIP_EXECUTION;\r
+\r
+ if (diff < 0.0)\r
+ {\r
+ diff = 0.0 - diff;\r
+ }\r
+ if (pos_delta < 0.0)\r
+ {\r
+ pos_delta = 0.0 - pos_delta;\r
+ }\r
+\r
+ //This first part of this condition will catch any NaN or Infinite values\r
+ if ((diff * 0.0 != 0.0) || (pos_delta < diff))\r
+ {\r
+ UnityTestResultsFailBegin(lineNumber);\r
+#ifdef UNITY_DOUBLE_VERBOSE\r
+ UnityPrint(UnityStrExpected);\r
+ UnityPrintFloat((float)expected);\r
+ UnityPrint(UnityStrWas);\r
+ UnityPrintFloat((float)actual);\r
+#else\r
+ UnityPrint(UnityStrDelta);\r
+#endif\r
+ UnityAddMsgIfSpecified(msg);\r
+ UNITY_FAIL_AND_BAIL;\r
+ }\r
+}\r
+\r
+//-----------------------------------------------\r
+\r
+void UnityAssertDoubleSpecial(const _UD actual,\r
+ const char* msg,\r
+ const UNITY_LINE_TYPE lineNumber,\r
+ const UNITY_FLOAT_TRAIT_T style)\r
+{\r
+ UNITY_SKIP_EXECUTION;\r
+\r
+ const char* trait_names[] = { UnityStrInf, UnityStrNegInf, UnityStrNaN, UnityStrDet };\r
+ _U_SINT should_be_trait = ((_U_SINT)style & 1);\r
+ _U_SINT is_trait = !should_be_trait;\r
+ _U_SINT trait_index = style >> 1;\r
+\r
+ switch(style)\r
+ {\r
+ //To determine Inf / Neg Inf, we compare to an Inf / Neg Inf value we create on the fly\r
+ //We are using a variable to hold the zero value because some compilers complain about dividing by zero otherwise\r
+ case UNITY_FLOAT_IS_INF:\r
+ case UNITY_FLOAT_IS_NOT_INF:\r
+ is_trait = ((1.0 / d_zero) == actual) ? 1 : 0;\r
+ break;\r
+ case UNITY_FLOAT_IS_NEG_INF:\r
+ case UNITY_FLOAT_IS_NOT_NEG_INF:\r
+ is_trait = ((-1.0 / d_zero) == actual) ? 1 : 0;\r
+ break;\r
+\r
+ //NaN is the only floating point value that does NOT equal itself. Therefore if Actual == Actual, then it is NOT NaN.\r
+ case UNITY_FLOAT_IS_NAN:\r
+ case UNITY_FLOAT_IS_NOT_NAN:\r
+ is_trait = (actual == actual) ? 0 : 1;\r
+ break;\r
+\r
+ //A determinate number is non infinite and not NaN. (therefore the opposite of the two above)\r
+ case UNITY_FLOAT_IS_DET:\r
+ case UNITY_FLOAT_IS_NOT_DET:\r
+ if ( (actual != actual) || ((1.0 / d_zero) == actual) || ((-1.0 / d_zero) == actual) )\r
+ is_trait = 0;\r
+ else\r
+ is_trait = 1;\r
+ break;\r
+ }\r
+\r
+ if (is_trait != should_be_trait)\r
+ {\r
+ UnityTestResultsFailBegin(lineNumber);\r
+ UnityPrint(UnityStrExpected);\r
+ if (!should_be_trait)\r
+ UnityPrint(UnityStrNot);\r
+ UnityPrint(trait_names[trait_index]);\r
+ UnityPrint(UnityStrWas);\r
+#ifdef UNITY_DOUBLE_VERBOSE\r
+ UnityPrintFloat(actual);\r
+#else\r
+ if (should_be_trait)\r
+ UnityPrint(UnityStrNot);\r
+ UnityPrint(trait_names[trait_index]);\r
+#endif\r
+ UnityAddMsgIfSpecified(msg);\r
+ UNITY_FAIL_AND_BAIL;\r
+ }\r
+}\r
+\r
+\r
+#endif // not UNITY_EXCLUDE_DOUBLE\r
+\r
+//-----------------------------------------------\r
+void UnityAssertNumbersWithin( const _U_SINT delta,\r
+ const _U_SINT expected,\r
+ const _U_SINT actual,\r
+ const char* msg,\r
+ const UNITY_LINE_TYPE lineNumber,\r
+ const UNITY_DISPLAY_STYLE_T style)\r
+{\r
+ UNITY_SKIP_EXECUTION;\r
+\r
+ if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT)\r
+ {\r
+ if (actual > expected)\r
+ Unity.CurrentTestFailed = ((actual - expected) > delta);\r
+ else\r
+ Unity.CurrentTestFailed = ((expected - actual) > delta);\r
+ }\r
+ else\r
+ {\r
+ if ((_U_UINT)actual > (_U_UINT)expected)\r
+ Unity.CurrentTestFailed = ((_U_UINT)(actual - expected) > (_U_UINT)delta);\r
+ else\r
+ Unity.CurrentTestFailed = ((_U_UINT)(expected - actual) > (_U_UINT)delta);\r
+ }\r
+\r
+ if (Unity.CurrentTestFailed)\r
+ {\r
+ UnityTestResultsFailBegin(lineNumber);\r
+ UnityPrint(UnityStrDelta);\r
+ UnityPrintNumberByStyle(delta, style);\r
+ UnityPrint(UnityStrExpected);\r
+ UnityPrintNumberByStyle(expected, style);\r
+ UnityPrint(UnityStrWas);\r
+ UnityPrintNumberByStyle(actual, style);\r
+ UnityAddMsgIfSpecified(msg);\r
+ UNITY_FAIL_AND_BAIL;\r
+ }\r
+}\r
+\r
+//-----------------------------------------------\r
+void UnityAssertEqualString(const char* expected,\r
+ const char* actual,\r
+ const char* msg,\r
+ const UNITY_LINE_TYPE lineNumber)\r
+{\r
+ _UU32 i;\r
+\r
+ UNITY_SKIP_EXECUTION;\r
+\r
+ // if both pointers not null compare the strings\r
+ if (expected && actual)\r
+ {\r
+ for (i = 0; expected[i] || actual[i]; i++)\r
+ {\r
+ if (expected[i] != actual[i])\r
+ {\r
+ Unity.CurrentTestFailed = 1;\r
+ break;\r
+ }\r
+ }\r
+ }\r
+ else\r
+ { // handle case of one pointers being null (if both null, test should pass)\r
+ if (expected != actual)\r
+ {\r
+ Unity.CurrentTestFailed = 1;\r
+ }\r
+ }\r
+\r
+ if (Unity.CurrentTestFailed)\r
+ {\r
+ UnityTestResultsFailBegin(lineNumber);\r
+ UnityPrintExpectedAndActualStrings(expected, actual);\r
+ UnityAddMsgIfSpecified(msg);\r
+ UNITY_FAIL_AND_BAIL;\r
+ }\r
+}\r
+\r
+//-----------------------------------------------\r
+void UnityAssertEqualStringArray( const char** expected,\r
+ const char** actual,\r
+ const _UU32 num_elements,\r
+ const char* msg,\r
+ const UNITY_LINE_TYPE lineNumber)\r
+{\r
+ _UU32 i, j = 0;\r
+\r
+ UNITY_SKIP_EXECUTION;\r
+\r
+ // if no elements, it's an error\r
+ if (num_elements == 0)\r
+ {\r
+ UnityTestResultsFailBegin(lineNumber);\r
+ UnityPrint(UnityStrPointless);\r
+ UnityAddMsgIfSpecified(msg);\r
+ UNITY_FAIL_AND_BAIL;\r
+ }\r
+\r
+ if (UnityCheckArraysForNull((UNITY_PTR_ATTRIBUTE void*)expected, (UNITY_PTR_ATTRIBUTE void*)actual, lineNumber, msg) == 1)\r
+ return;\r
+\r
+ do\r
+ {\r
+ // if both pointers not null compare the strings\r
+ if (expected[j] && actual[j])\r
+ {\r
+ for (i = 0; expected[j][i] || actual[j][i]; i++)\r
+ {\r
+ if (expected[j][i] != actual[j][i])\r
+ {\r
+ Unity.CurrentTestFailed = 1;\r
+ break;\r
+ }\r
+ }\r
+ }\r
+ else\r
+ { // handle case of one pointers being null (if both null, test should pass)\r
+ if (expected[j] != actual[j])\r
+ {\r
+ Unity.CurrentTestFailed = 1;\r
+ }\r
+ }\r
+\r
+ if (Unity.CurrentTestFailed)\r
+ {\r
+ UnityTestResultsFailBegin(lineNumber);\r
+ if (num_elements > 1)\r
+ {\r
+ UnityPrint(UnityStrElement);\r
+ UnityPrintNumberByStyle((j), UNITY_DISPLAY_STYLE_UINT);\r
+ }\r
+ UnityPrintExpectedAndActualStrings((const char*)(expected[j]), (const char*)(actual[j]));\r
+ UnityAddMsgIfSpecified(msg);\r
+ UNITY_FAIL_AND_BAIL;\r
+ }\r
+ } while (++j < num_elements);\r
+}\r
+\r
+//-----------------------------------------------\r
+void UnityAssertEqualMemory( UNITY_PTR_ATTRIBUTE const void* expected,\r
+ UNITY_PTR_ATTRIBUTE const void* actual,\r
+ const _UU32 length,\r
+ const _UU32 num_elements,\r
+ const char* msg,\r
+ const UNITY_LINE_TYPE lineNumber)\r
+{\r
+ UNITY_PTR_ATTRIBUTE const unsigned char* ptr_exp = (UNITY_PTR_ATTRIBUTE const unsigned char*)expected;\r
+ UNITY_PTR_ATTRIBUTE const unsigned char* ptr_act = (UNITY_PTR_ATTRIBUTE const unsigned char*)actual;\r
+ _UU32 elements = num_elements;\r
+ _UU32 bytes;\r
+\r
+ UNITY_SKIP_EXECUTION;\r
+\r
+ if ((elements == 0) || (length == 0))\r
+ {\r
+ UnityTestResultsFailBegin(lineNumber);\r
+ UnityPrint(UnityStrPointless);\r
+ UnityAddMsgIfSpecified(msg);\r
+ UNITY_FAIL_AND_BAIL;\r
+ }\r
+\r
+ if (UnityCheckArraysForNull((UNITY_PTR_ATTRIBUTE const void*)expected, (UNITY_PTR_ATTRIBUTE const void*)actual, lineNumber, msg) == 1)\r
+ return;\r
+\r
+ while (elements--)\r
+ {\r
+ /////////////////////////////////////\r
+ bytes = length;\r
+ while (bytes--)\r
+ {\r
+ if (*ptr_exp != *ptr_act)\r
+ {\r
+ UnityTestResultsFailBegin(lineNumber);\r
+ UnityPrint(UnityStrMemory);\r
+ if (num_elements > 1)\r
+ {\r
+ UnityPrint(UnityStrElement);\r
+ UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);\r
+ }\r
+ UnityPrint(UnityStrByte);\r
+ UnityPrintNumberByStyle((length - bytes - 1), UNITY_DISPLAY_STYLE_UINT);\r
+ UnityPrint(UnityStrExpected);\r
+ UnityPrintNumberByStyle(*ptr_exp, UNITY_DISPLAY_STYLE_HEX8);\r
+ UnityPrint(UnityStrWas);\r
+ UnityPrintNumberByStyle(*ptr_act, UNITY_DISPLAY_STYLE_HEX8);\r
+ UnityAddMsgIfSpecified(msg);\r
+ UNITY_FAIL_AND_BAIL;\r
+ }\r
+ ptr_exp += 1;\r
+ ptr_act += 1;\r
+ }\r
+ /////////////////////////////////////\r
+\r
+ }\r
+}\r
+\r
+//-----------------------------------------------\r
+// Control Functions\r
+//-----------------------------------------------\r
+\r
+void UnityFail(const char* msg, const UNITY_LINE_TYPE line)\r
+{\r
+ UNITY_SKIP_EXECUTION;\r
+\r
+ UnityTestResultsBegin(Unity.TestFile, line);\r
+ UnityPrintFail();\r
+ if (msg != NULL)\r
+ {\r
+ UNITY_OUTPUT_CHAR(':');\r
+ if (msg[0] != ' ')\r
+ {\r
+ UNITY_OUTPUT_CHAR(' ');\r
+ }\r
+ UnityPrint(msg);\r
+ }\r
+ UNITY_FAIL_AND_BAIL;\r
+}\r
+\r
+//-----------------------------------------------\r
+void UnityIgnore(const char* msg, const UNITY_LINE_TYPE line)\r
+{\r
+ UNITY_SKIP_EXECUTION;\r
+\r
+ UnityTestResultsBegin(Unity.TestFile, line);\r
+ UnityPrint(UnityStrIgnore);\r
+ if (msg != NULL)\r
+ {\r
+ UNITY_OUTPUT_CHAR(':');\r
+ UNITY_OUTPUT_CHAR(' ');\r
+ UnityPrint(msg);\r
+ }\r
+ UNITY_IGNORE_AND_BAIL;\r
+}\r
+\r
+//-----------------------------------------------\r
+#ifdef UNITY_SUPPORT_WEAK\r
+UNITY_WEAK void setUp(void) { }\r
+UNITY_WEAK void tearDown(void) { }\r
+#else\r
+void setUp(void);\r
+void tearDown(void);\r
+#endif\r
+//-----------------------------------------------\r
+void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum)\r
+{\r
+ Unity.CurrentTestName = FuncName;\r
+ Unity.CurrentTestLineNumber = (UNITY_LINE_TYPE)FuncLineNum;\r
+ Unity.NumberOfTests++;\r
+ if (TEST_PROTECT())\r
+ {\r
+ setUp();\r
+ Func();\r
+ }\r
+ if (TEST_PROTECT() && !(Unity.CurrentTestIgnored))\r
+ {\r
+ tearDown();\r
+ }\r
+ UnityConcludeTest();\r
+}\r
+\r
+//-----------------------------------------------\r
+void UnityBegin(const char* filename)\r
+{\r
+ Unity.TestFile = filename;\r
+ Unity.CurrentTestName = NULL;\r
+ Unity.CurrentTestLineNumber = 0;\r
+ Unity.NumberOfTests = 0;\r
+ Unity.TestFailures = 0;\r
+ Unity.TestIgnores = 0;\r
+ Unity.CurrentTestFailed = 0;\r
+ Unity.CurrentTestIgnored = 0;\r
+\r
+ UNITY_OUTPUT_START();\r
+}\r
+\r
+//-----------------------------------------------\r
+int UnityEnd(void)\r
+{\r
+ UNITY_PRINT_EOL;\r
+ UnityPrint(UnityStrBreaker);\r
+ UNITY_PRINT_EOL;\r
+ UnityPrintNumber((_U_SINT)(Unity.NumberOfTests));\r
+ UnityPrint(UnityStrResultsTests);\r
+ UnityPrintNumber((_U_SINT)(Unity.TestFailures));\r
+ UnityPrint(UnityStrResultsFailures);\r
+ UnityPrintNumber((_U_SINT)(Unity.TestIgnores));\r
+ UnityPrint(UnityStrResultsIgnored);\r
+ UNITY_PRINT_EOL;\r
+ if (Unity.TestFailures == 0U)\r
+ {\r
+ UnityPrintOk();\r
+ }\r
+ else\r
+ {\r
+ UnityPrintFail();\r
+ }\r
+ UNITY_PRINT_EOL;\r
+ UNITY_OUTPUT_COMPLETE();\r
+ return (int)(Unity.TestFailures);\r
+}\r
+\r
+//-----------------------------------------------\r
+\r
+\r
--- /dev/null
+/* ==========================================\r
+ Unity Project - A Test Framework for C\r
+ Copyright (c) 2007-14 Mike Karlesky, Mark VanderVoord, Greg Williams\r
+ [Released under MIT License. Please refer to license.txt for details]\r
+========================================== */\r
+\r
+#ifndef UNITY_FRAMEWORK_H\r
+#define UNITY_FRAMEWORK_H\r
+#define UNITY\r
+\r
+#include "unity_internals.h"\r
+\r
+//-------------------------------------------------------\r
+// Configuration Options\r
+//-------------------------------------------------------\r
+// All options described below should be passed as a compiler flag to all files using Unity. If you must add #defines, place them BEFORE the #include above.\r
+\r
+// Integers/longs/pointers\r
+// - Unity attempts to automatically discover your integer sizes\r
+// - define UNITY_EXCLUDE_STDINT_H to stop attempting to look in <stdint.h>\r
+// - define UNITY_EXCLUDE_LIMITS_H to stop attempting to look in <limits.h>\r
+// - define UNITY_EXCLUDE_SIZEOF to stop attempting to use sizeof in macros\r
+// - If you cannot use the automatic methods above, you can force Unity by using these options:\r
+// - define UNITY_SUPPORT_64\r
+// - define UNITY_INT_WIDTH\r
+// - UNITY_LONG_WIDTH\r
+// - UNITY_POINTER_WIDTH\r
+\r
+// Floats\r
+// - define UNITY_EXCLUDE_FLOAT to disallow floating point comparisons\r
+// - define UNITY_FLOAT_PRECISION to specify the precision to use when doing TEST_ASSERT_EQUAL_FLOAT\r
+// - define UNITY_FLOAT_TYPE to specify doubles instead of single precision floats\r
+// - define UNITY_FLOAT_VERBOSE to print floating point values in errors (uses sprintf)\r
+// - define UNITY_INCLUDE_DOUBLE to allow double floating point comparisons\r
+// - define UNITY_EXCLUDE_DOUBLE to disallow double floating point comparisons (default)\r
+// - define UNITY_DOUBLE_PRECISION to specify the precision to use when doing TEST_ASSERT_EQUAL_DOUBLE\r
+// - define UNITY_DOUBLE_TYPE to specify something other than double\r
+// - define UNITY_DOUBLE_VERBOSE to print floating point values in errors (uses sprintf)\r
+\r
+// Output\r
+// - by default, Unity prints to standard out with putchar. define UNITY_OUTPUT_CHAR(a) with a different function if desired\r
+\r
+// Optimization\r
+// - by default, line numbers are stored in unsigned shorts. Define UNITY_LINE_TYPE with a different type if your files are huge\r
+// - by default, test and failure counters are unsigned shorts. Define UNITY_COUNTER_TYPE with a different type if you want to save space or have more than 65535 Tests.\r
+\r
+// Test Cases\r
+// - define UNITY_SUPPORT_TEST_CASES to include the TEST_CASE macro, though really it's mostly about the runner generator script\r
+\r
+// Parameterized Tests\r
+// - you'll want to create a define of TEST_CASE(...) which basically evaluates to nothing\r
+\r
+//-------------------------------------------------------\r
+// Basic Fail and Ignore\r
+//-------------------------------------------------------\r
+\r
+#define TEST_FAIL_MESSAGE(message) UNITY_TEST_FAIL(__LINE__, message)\r
+#define TEST_FAIL() UNITY_TEST_FAIL(__LINE__, NULL)\r
+#define TEST_IGNORE_MESSAGE(message) UNITY_TEST_IGNORE(__LINE__, message)\r
+#define TEST_IGNORE() UNITY_TEST_IGNORE(__LINE__, NULL)\r
+#define TEST_ONLY()\r
+\r
+//-------------------------------------------------------\r
+// Test Asserts (simple)\r
+//-------------------------------------------------------\r
+\r
+//Boolean\r
+#define TEST_ASSERT(condition) UNITY_TEST_ASSERT( (condition), __LINE__, " Expression Evaluated To FALSE")\r
+#define TEST_ASSERT_TRUE(condition) UNITY_TEST_ASSERT( (condition), __LINE__, " Expected TRUE Was FALSE")\r
+#define TEST_ASSERT_UNLESS(condition) UNITY_TEST_ASSERT( !(condition), __LINE__, " Expression Evaluated To TRUE")\r
+#define TEST_ASSERT_FALSE(condition) UNITY_TEST_ASSERT( !(condition), __LINE__, " Expected FALSE Was TRUE")\r
+#define TEST_ASSERT_NULL(pointer) UNITY_TEST_ASSERT_NULL( (pointer), __LINE__, " Expected NULL")\r
+#define TEST_ASSERT_NOT_NULL(pointer) UNITY_TEST_ASSERT_NOT_NULL((pointer), __LINE__, " Expected Non-NULL")\r
+\r
+//Integers (of all sizes)\r
+#define TEST_ASSERT_EQUAL_INT(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, NULL)\r
+#define TEST_ASSERT_EQUAL_INT8(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT8((expected), (actual), __LINE__, NULL)\r
+#define TEST_ASSERT_EQUAL_INT16(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT16((expected), (actual), __LINE__, NULL)\r
+#define TEST_ASSERT_EQUAL_INT32(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT32((expected), (actual), __LINE__, NULL)\r
+#define TEST_ASSERT_EQUAL_INT64(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT64((expected), (actual), __LINE__, NULL)\r
+#define TEST_ASSERT_EQUAL(expected, actual) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, NULL)\r
+#define TEST_ASSERT_NOT_EQUAL(expected, actual) UNITY_TEST_ASSERT(((expected) != (actual)), __LINE__, " Expected Not-Equal")\r
+#define TEST_ASSERT_EQUAL_UINT(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT( (expected), (actual), __LINE__, NULL)\r
+#define TEST_ASSERT_EQUAL_UINT8(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT8( (expected), (actual), __LINE__, NULL)\r
+#define TEST_ASSERT_EQUAL_UINT16(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT16( (expected), (actual), __LINE__, NULL)\r
+#define TEST_ASSERT_EQUAL_UINT32(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT32( (expected), (actual), __LINE__, NULL)\r
+#define TEST_ASSERT_EQUAL_UINT64(expected, actual) UNITY_TEST_ASSERT_EQUAL_UINT64( (expected), (actual), __LINE__, NULL)\r
+#define TEST_ASSERT_EQUAL_HEX(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, NULL)\r
+#define TEST_ASSERT_EQUAL_HEX8(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX8( (expected), (actual), __LINE__, NULL)\r
+#define TEST_ASSERT_EQUAL_HEX16(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX16((expected), (actual), __LINE__, NULL)\r
+#define TEST_ASSERT_EQUAL_HEX32(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, NULL)\r
+#define TEST_ASSERT_EQUAL_HEX64(expected, actual) UNITY_TEST_ASSERT_EQUAL_HEX64((expected), (actual), __LINE__, NULL)\r
+#define TEST_ASSERT_BITS(mask, expected, actual) UNITY_TEST_ASSERT_BITS((mask), (expected), (actual), __LINE__, NULL)\r
+#define TEST_ASSERT_BITS_HIGH(mask, actual) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(-1), (actual), __LINE__, NULL)\r
+#define TEST_ASSERT_BITS_LOW(mask, actual) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(0), (actual), __LINE__, NULL)\r
+#define TEST_ASSERT_BIT_HIGH(bit, actual) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(-1), (actual), __LINE__, NULL)\r
+#define TEST_ASSERT_BIT_LOW(bit, actual) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(0), (actual), __LINE__, NULL)\r
+\r
+//Integer Ranges (of all sizes)\r
+#define TEST_ASSERT_INT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, __LINE__, NULL)\r
+#define TEST_ASSERT_INT8_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_INT8_WITHIN(delta, expected, actual, __LINE__, NULL)\r
+#define TEST_ASSERT_INT16_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_INT16_WITHIN(delta, expected, actual, __LINE__, NULL)\r
+#define TEST_ASSERT_INT32_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_INT32_WITHIN(delta, expected, actual, __LINE__, NULL)\r
+#define TEST_ASSERT_INT64_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_INT64_WITHIN(delta, expected, actual, __LINE__, NULL)\r
+#define TEST_ASSERT_UINT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, __LINE__, NULL)\r
+#define TEST_ASSERT_UINT8_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_UINT8_WITHIN(delta, expected, actual, __LINE__, NULL)\r
+#define TEST_ASSERT_UINT16_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_UINT16_WITHIN(delta, expected, actual, __LINE__, NULL)\r
+#define TEST_ASSERT_UINT32_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_UINT32_WITHIN(delta, expected, actual, __LINE__, NULL)\r
+#define TEST_ASSERT_UINT64_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_UINT64_WITHIN(delta, expected, actual, __LINE__, NULL)\r
+#define TEST_ASSERT_HEX_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, NULL)\r
+#define TEST_ASSERT_HEX8_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, __LINE__, NULL)\r
+#define TEST_ASSERT_HEX16_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, __LINE__, NULL)\r
+#define TEST_ASSERT_HEX32_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, NULL)\r
+#define TEST_ASSERT_HEX64_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, __LINE__, NULL)\r
+\r
+//Structs and Strings\r
+#define TEST_ASSERT_EQUAL_PTR(expected, actual) UNITY_TEST_ASSERT_EQUAL_PTR((expected), (actual), __LINE__, NULL)\r
+#define TEST_ASSERT_EQUAL_STRING(expected, actual) UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, __LINE__, NULL)\r
+#define TEST_ASSERT_EQUAL_MEMORY(expected, actual, len) UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, __LINE__, NULL)\r
+\r
+//Arrays\r
+#define TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, __LINE__, NULL)\r
+#define TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, __LINE__, NULL)\r
+#define TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, __LINE__, NULL)\r
+#define TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, __LINE__, NULL)\r
+#define TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, __LINE__, NULL)\r
+#define TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, __LINE__, NULL)\r
+#define TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, __LINE__, NULL)\r
+#define TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, __LINE__, NULL)\r
+#define TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, __LINE__, NULL)\r
+#define TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, __LINE__, NULL)\r
+#define TEST_ASSERT_EQUAL_HEX_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, NULL)\r
+#define TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, __LINE__, NULL)\r
+#define TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, __LINE__, NULL)\r
+#define TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, NULL)\r
+#define TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, __LINE__, NULL)\r
+#define TEST_ASSERT_EQUAL_PTR_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_PTR_ARRAY(expected, actual, num_elements, __LINE__, NULL)\r
+#define TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, __LINE__, NULL)\r
+#define TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements) UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, __LINE__, NULL)\r
+\r
+//Floating Point (If Enabled)\r
+#define TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, __LINE__, NULL)\r
+#define TEST_ASSERT_EQUAL_FLOAT(expected, actual) UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, __LINE__, NULL)\r
+#define TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, __LINE__, NULL)\r
+#define TEST_ASSERT_FLOAT_IS_INF(actual) UNITY_TEST_ASSERT_FLOAT_IS_INF(actual, __LINE__, NULL)\r
+#define TEST_ASSERT_FLOAT_IS_NEG_INF(actual) UNITY_TEST_ASSERT_FLOAT_IS_NEG_INF(actual, __LINE__, NULL)\r
+#define TEST_ASSERT_FLOAT_IS_NAN(actual) UNITY_TEST_ASSERT_FLOAT_IS_NAN(actual, __LINE__, NULL)\r
+#define TEST_ASSERT_FLOAT_IS_DETERMINATE(actual) UNITY_TEST_ASSERT_FLOAT_IS_DETERMINATE(actual, __LINE__, NULL)\r
+#define TEST_ASSERT_FLOAT_IS_NOT_INF(actual) UNITY_TEST_ASSERT_FLOAT_IS_NOT_INF(actual, __LINE__, NULL)\r
+#define TEST_ASSERT_FLOAT_IS_NOT_NEG_INF(actual) UNITY_TEST_ASSERT_FLOAT_IS_NOT_NEG_INF(actual, __LINE__, NULL)\r
+#define TEST_ASSERT_FLOAT_IS_NOT_NAN(actual) UNITY_TEST_ASSERT_FLOAT_IS_NOT_NAN(actual, __LINE__, NULL)\r
+#define TEST_ASSERT_FLOAT_IS_NOT_DETERMINATE(actual) UNITY_TEST_ASSERT_FLOAT_IS_NOT_DETERMINATE(actual, __LINE__, NULL)\r
+\r
+//Double (If Enabled)\r
+#define TEST_ASSERT_DOUBLE_WITHIN(delta, expected, actual) UNITY_TEST_ASSERT_DOUBLE_WITHIN(delta, expected, actual, __LINE__, NULL)\r
+#define TEST_ASSERT_EQUAL_DOUBLE(expected, actual) UNITY_TEST_ASSERT_EQUAL_DOUBLE(expected, actual, __LINE__, NULL)\r
+#define TEST_ASSERT_EQUAL_DOUBLE_ARRAY(expected, actual, num_elements) UNITY_TEST_ASSERT_EQUAL_DOUBLE_ARRAY(expected, actual, num_elements, __LINE__, NULL)\r
+#define TEST_ASSERT_DOUBLE_IS_INF(actual) UNITY_TEST_ASSERT_DOUBLE_IS_INF(actual, __LINE__, NULL)\r
+#define TEST_ASSERT_DOUBLE_IS_NEG_INF(actual) UNITY_TEST_ASSERT_DOUBLE_IS_NEG_INF(actual, __LINE__, NULL)\r
+#define TEST_ASSERT_DOUBLE_IS_NAN(actual) UNITY_TEST_ASSERT_DOUBLE_IS_NAN(actual, __LINE__, NULL)\r
+#define TEST_ASSERT_DOUBLE_IS_DETERMINATE(actual) UNITY_TEST_ASSERT_DOUBLE_IS_DETERMINATE(actual, __LINE__, NULL)\r
+#define TEST_ASSERT_DOUBLE_IS_NOT_INF(actual) UNITY_TEST_ASSERT_DOUBLE_IS_NOT_INF(actual, __LINE__, NULL)\r
+#define TEST_ASSERT_DOUBLE_IS_NOT_NEG_INF(actual) UNITY_TEST_ASSERT_DOUBLE_IS_NOT_NEG_INF(actual, __LINE__, NULL)\r
+#define TEST_ASSERT_DOUBLE_IS_NOT_NAN(actual) UNITY_TEST_ASSERT_DOUBLE_IS_NOT_NAN(actual, __LINE__, NULL)\r
+#define TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE(actual) UNITY_TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE(actual, __LINE__, NULL)\r
+\r
+//-------------------------------------------------------\r
+// Test Asserts (with additional messages)\r
+//-------------------------------------------------------\r
+\r
+//Boolean\r
+#define TEST_ASSERT_MESSAGE(condition, message) UNITY_TEST_ASSERT( (condition), __LINE__, message)\r
+#define TEST_ASSERT_TRUE_MESSAGE(condition, message) UNITY_TEST_ASSERT( (condition), __LINE__, message)\r
+#define TEST_ASSERT_UNLESS_MESSAGE(condition, message) UNITY_TEST_ASSERT( !(condition), __LINE__, message)\r
+#define TEST_ASSERT_FALSE_MESSAGE(condition, message) UNITY_TEST_ASSERT( !(condition), __LINE__, message)\r
+#define TEST_ASSERT_NULL_MESSAGE(pointer, message) UNITY_TEST_ASSERT_NULL( (pointer), __LINE__, message)\r
+#define TEST_ASSERT_NOT_NULL_MESSAGE(pointer, message) UNITY_TEST_ASSERT_NOT_NULL((pointer), __LINE__, message)\r
+\r
+//Integers (of all sizes)\r
+#define TEST_ASSERT_EQUAL_INT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, message)\r
+#define TEST_ASSERT_EQUAL_INT8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT8((expected), (actual), __LINE__, message)\r
+#define TEST_ASSERT_EQUAL_INT16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT16((expected), (actual), __LINE__, message)\r
+#define TEST_ASSERT_EQUAL_INT32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT32((expected), (actual), __LINE__, message)\r
+#define TEST_ASSERT_EQUAL_INT64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT64((expected), (actual), __LINE__, message)\r
+#define TEST_ASSERT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_INT((expected), (actual), __LINE__, message)\r
+#define TEST_ASSERT_NOT_EQUAL_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT(((expected) != (actual)), __LINE__, message)\r
+#define TEST_ASSERT_EQUAL_UINT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT( (expected), (actual), __LINE__, message)\r
+#define TEST_ASSERT_EQUAL_UINT8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT8( (expected), (actual), __LINE__, message)\r
+#define TEST_ASSERT_EQUAL_UINT16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT16( (expected), (actual), __LINE__, message)\r
+#define TEST_ASSERT_EQUAL_UINT32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT32( (expected), (actual), __LINE__, message)\r
+#define TEST_ASSERT_EQUAL_UINT64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_UINT64( (expected), (actual), __LINE__, message)\r
+#define TEST_ASSERT_EQUAL_HEX_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, message)\r
+#define TEST_ASSERT_EQUAL_HEX8_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX8( (expected), (actual), __LINE__, message)\r
+#define TEST_ASSERT_EQUAL_HEX16_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX16((expected), (actual), __LINE__, message)\r
+#define TEST_ASSERT_EQUAL_HEX32_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX32((expected), (actual), __LINE__, message)\r
+#define TEST_ASSERT_EQUAL_HEX64_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_HEX64((expected), (actual), __LINE__, message)\r
+#define TEST_ASSERT_BITS_MESSAGE(mask, expected, actual, message) UNITY_TEST_ASSERT_BITS((mask), (expected), (actual), __LINE__, message)\r
+#define TEST_ASSERT_BITS_HIGH_MESSAGE(mask, actual, message) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(-1), (actual), __LINE__, message)\r
+#define TEST_ASSERT_BITS_LOW_MESSAGE(mask, actual, message) UNITY_TEST_ASSERT_BITS((mask), (_UU32)(0), (actual), __LINE__, message)\r
+#define TEST_ASSERT_BIT_HIGH_MESSAGE(bit, actual, message) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(-1), (actual), __LINE__, message)\r
+#define TEST_ASSERT_BIT_LOW_MESSAGE(bit, actual, message) UNITY_TEST_ASSERT_BITS(((_UU32)1 << bit), (_UU32)(0), (actual), __LINE__, message)\r
+\r
+//Integer Ranges (of all sizes)\r
+#define TEST_ASSERT_INT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, __LINE__, message)\r
+#define TEST_ASSERT_INT8_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_INT8_WITHIN(delta, expected, actual, __LINE__, message)\r
+#define TEST_ASSERT_INT16_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_INT16_WITHIN(delta, expected, actual, __LINE__, message)\r
+#define TEST_ASSERT_INT32_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_INT32_WITHIN(delta, expected, actual, __LINE__, message)\r
+#define TEST_ASSERT_INT64_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_INT64_WITHIN(delta, expected, actual, __LINE__, message)\r
+#define TEST_ASSERT_UINT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, __LINE__, message)\r
+#define TEST_ASSERT_UINT8_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_UINT8_WITHIN(delta, expected, actual, __LINE__, message)\r
+#define TEST_ASSERT_UINT16_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_UINT16_WITHIN(delta, expected, actual, __LINE__, message)\r
+#define TEST_ASSERT_UINT32_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_UINT32_WITHIN(delta, expected, actual, __LINE__, message)\r
+#define TEST_ASSERT_UINT64_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_UINT64_WITHIN(delta, expected, actual, __LINE__, message)\r
+#define TEST_ASSERT_HEX_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, message)\r
+#define TEST_ASSERT_HEX8_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, __LINE__, message)\r
+#define TEST_ASSERT_HEX16_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, __LINE__, message)\r
+#define TEST_ASSERT_HEX32_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, __LINE__, message)\r
+#define TEST_ASSERT_HEX64_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, __LINE__, message)\r
+\r
+//Structs and Strings\r
+#define TEST_ASSERT_EQUAL_PTR_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_PTR(expected, actual, __LINE__, message)\r
+#define TEST_ASSERT_EQUAL_STRING_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, __LINE__, message)\r
+#define TEST_ASSERT_EQUAL_MEMORY_MESSAGE(expected, actual, len, message) UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, __LINE__, message)\r
+\r
+//Arrays\r
+#define TEST_ASSERT_EQUAL_INT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, __LINE__, message)\r
+#define TEST_ASSERT_EQUAL_INT8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, __LINE__, message)\r
+#define TEST_ASSERT_EQUAL_INT16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, __LINE__, message)\r
+#define TEST_ASSERT_EQUAL_INT32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, __LINE__, message)\r
+#define TEST_ASSERT_EQUAL_INT64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, __LINE__, message)\r
+#define TEST_ASSERT_EQUAL_UINT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, __LINE__, message)\r
+#define TEST_ASSERT_EQUAL_UINT8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, __LINE__, message)\r
+#define TEST_ASSERT_EQUAL_UINT16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, __LINE__, message)\r
+#define TEST_ASSERT_EQUAL_UINT32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, __LINE__, message)\r
+#define TEST_ASSERT_EQUAL_UINT64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, __LINE__, message)\r
+#define TEST_ASSERT_EQUAL_HEX_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, message)\r
+#define TEST_ASSERT_EQUAL_HEX8_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, __LINE__, message)\r
+#define TEST_ASSERT_EQUAL_HEX16_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, __LINE__, message)\r
+#define TEST_ASSERT_EQUAL_HEX32_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, __LINE__, message)\r
+#define TEST_ASSERT_EQUAL_HEX64_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, __LINE__, message)\r
+#define TEST_ASSERT_EQUAL_PTR_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_PTR_ARRAY(expected, actual, num_elements, __LINE__, message)\r
+#define TEST_ASSERT_EQUAL_STRING_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, __LINE__, message)\r
+#define TEST_ASSERT_EQUAL_MEMORY_ARRAY_MESSAGE(expected, actual, len, num_elements, message) UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, __LINE__, message)\r
+\r
+//Floating Point (If Enabled)\r
+#define TEST_ASSERT_FLOAT_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, __LINE__, message)\r
+#define TEST_ASSERT_EQUAL_FLOAT_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, __LINE__, message)\r
+#define TEST_ASSERT_EQUAL_FLOAT_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, __LINE__, message)\r
+#define TEST_ASSERT_FLOAT_IS_INF_MESSAGE(actual, message) UNITY_TEST_ASSERT_FLOAT_IS_INF(actual, __LINE__, message)\r
+#define TEST_ASSERT_FLOAT_IS_NEG_INF_MESSAGE(actual, message) UNITY_TEST_ASSERT_FLOAT_IS_NEG_INF(actual, __LINE__, message)\r
+#define TEST_ASSERT_FLOAT_IS_NAN_MESSAGE(actual, message) UNITY_TEST_ASSERT_FLOAT_IS_NAN(actual, __LINE__, message)\r
+#define TEST_ASSERT_FLOAT_IS_DETERMINATE_MESSAGE(actual, message) UNITY_TEST_ASSERT_FLOAT_IS_DETERMINATE(actual, __LINE__, message)\r
+#define TEST_ASSERT_FLOAT_IS_NOT_INF_MESSAGE(actual, message) UNITY_TEST_ASSERT_FLOAT_IS_NOT_INF(actual, __LINE__, message)\r
+#define TEST_ASSERT_FLOAT_IS_NOT_NEG_INF_MESSAGE(actual, message) UNITY_TEST_ASSERT_FLOAT_IS_NOT_NEG_INF(actual, __LINE__, message)\r
+#define TEST_ASSERT_FLOAT_IS_NOT_NAN_MESSAGE(actual, message) UNITY_TEST_ASSERT_FLOAT_IS_NOT_NAN(actual, __LINE__, message)\r
+#define TEST_ASSERT_FLOAT_IS_NOT_DETERMINATE_MESSAGE(actual, message) UNITY_TEST_ASSERT_FLOAT_IS_NOT_DETERMINATE(actual, __LINE__, message)\r
+\r
+//Double (If Enabled)\r
+#define TEST_ASSERT_DOUBLE_WITHIN_MESSAGE(delta, expected, actual, message) UNITY_TEST_ASSERT_DOUBLE_WITHIN(delta, expected, actual, __LINE__, message)\r
+#define TEST_ASSERT_EQUAL_DOUBLE_MESSAGE(expected, actual, message) UNITY_TEST_ASSERT_EQUAL_DOUBLE(expected, actual, __LINE__, message)\r
+#define TEST_ASSERT_EQUAL_DOUBLE_ARRAY_MESSAGE(expected, actual, num_elements, message) UNITY_TEST_ASSERT_EQUAL_DOUBLE_ARRAY(expected, actual, num_elements, __LINE__, message)\r
+#define TEST_ASSERT_DOUBLE_IS_INF_MESSAGE(actual, message) UNITY_TEST_ASSERT_DOUBLE_IS_INF(actual, __LINE__, message)\r
+#define TEST_ASSERT_DOUBLE_IS_NEG_INF_MESSAGE(actual, message) UNITY_TEST_ASSERT_DOUBLE_IS_NEG_INF(actual, __LINE__, message)\r
+#define TEST_ASSERT_DOUBLE_IS_NAN_MESSAGE(actual, message) UNITY_TEST_ASSERT_DOUBLE_IS_NAN(actual, __LINE__, message)\r
+#define TEST_ASSERT_DOUBLE_IS_DETERMINATE_MESSAGE(actual, message) UNITY_TEST_ASSERT_DOUBLE_IS_DETERMINATE(actual, __LINE__, message)\r
+#define TEST_ASSERT_DOUBLE_IS_NOT_INF_MESSAGE(actual, message) UNITY_TEST_ASSERT_DOUBLE_IS_NOT_INF(actual, __LINE__, message)\r
+#define TEST_ASSERT_DOUBLE_IS_NOT_NEG_INF_MESSAGE(actual, message) UNITY_TEST_ASSERT_DOUBLE_IS_NOT_NEG_INF(actual, __LINE__, message)\r
+#define TEST_ASSERT_DOUBLE_IS_NOT_NAN_MESSAGE(actual, message) UNITY_TEST_ASSERT_DOUBLE_IS_NOT_NAN(actual, __LINE__, message)\r
+#define TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE_MESSAGE(actual, message) UNITY_TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE(actual, __LINE__, message)\r
+\r
+//end of UNITY_FRAMEWORK_H\r
+#endif\r
--- /dev/null
+/* ==========================================\r
+ Unity Project - A Test Framework for C\r
+ Copyright (c) 2007-14 Mike Karlesky, Mark VanderVoord, Greg Williams\r
+ [Released under MIT License. Please refer to license.txt for details]\r
+========================================== */\r
+\r
+#ifndef UNITY_INTERNALS_H\r
+#define UNITY_INTERNALS_H\r
+\r
+#ifdef UNITY_INCLUDE_CONFIG_H\r
+#include "unity_config.h"\r
+#endif\r
+\r
+#include <setjmp.h>\r
+\r
+// Unity Attempts to Auto-Detect Integer Types\r
+// Attempt 1: UINT_MAX, ULONG_MAX, etc in <stdint.h>\r
+// Attempt 2: UINT_MAX, ULONG_MAX, etc in <limits.h>\r
+// Attempt 3: Deduced from sizeof() macros\r
+#ifndef UNITY_EXCLUDE_STDINT_H\r
+#include <stdint.h>\r
+#endif\r
+\r
+#ifndef UNITY_EXCLUDE_LIMITS_H\r
+#include <limits.h>\r
+#endif\r
+\r
+#ifndef UNITY_EXCLUDE_SIZEOF\r
+#ifndef UINT_MAX\r
+#define UINT_MAX (sizeof(unsigned int) * 256 - 1)\r
+#endif\r
+#ifndef ULONG_MAX\r
+#define ULONG_MAX (sizeof(unsigned long) * 256 - 1)\r
+#endif\r
+#ifndef UINTPTR_MAX\r
+//apparently this is not a constant expression: (sizeof(unsigned int *) * 256 - 1) so we have to just let this fall through\r
+#endif\r
+#endif\r
+//-------------------------------------------------------\r
+// Guess Widths If Not Specified\r
+//-------------------------------------------------------\r
+\r
+// Determine the size of an int, if not already specificied.\r
+// We cannot use sizeof(int), because it is not yet defined\r
+// at this stage in the trnslation of the C program.\r
+// Therefore, infer it from UINT_MAX if possible.\r
+#ifndef UNITY_INT_WIDTH\r
+ #ifdef UINT_MAX\r
+ #if (UINT_MAX == 0xFFFF)\r
+ #define UNITY_INT_WIDTH (16)\r
+ #elif (UINT_MAX == 0xFFFFFFFF)\r
+ #define UNITY_INT_WIDTH (32)\r
+ #elif (UINT_MAX == 0xFFFFFFFFFFFFFFFF)\r
+ #define UNITY_INT_WIDTH (64)\r
+ #endif\r
+ #endif\r
+#endif\r
+#ifndef UNITY_INT_WIDTH\r
+ #define UNITY_INT_WIDTH (32)\r
+#endif\r
+\r
+// Determine the size of a long, if not already specified,\r
+// by following the process used above to define\r
+// UNITY_INT_WIDTH.\r
+#ifndef UNITY_LONG_WIDTH\r
+ #ifdef ULONG_MAX\r
+ #if (ULONG_MAX == 0xFFFF)\r
+ #define UNITY_LONG_WIDTH (16)\r
+ #elif (ULONG_MAX == 0xFFFFFFFF)\r
+ #define UNITY_LONG_WIDTH (32)\r
+ #elif (ULONG_MAX == 0xFFFFFFFFFFFFFFFF)\r
+ #define UNITY_LONG_WIDTH (64)\r
+ #endif\r
+ #endif\r
+#endif\r
+#ifndef UNITY_LONG_WIDTH\r
+ #define UNITY_LONG_WIDTH (32)\r
+#endif\r
+\r
+// Determine the size of a pointer, if not already specified,\r
+// by following the process used above to define\r
+// UNITY_INT_WIDTH.\r
+#ifndef UNITY_POINTER_WIDTH\r
+ #ifdef UINTPTR_MAX\r
+ #if (UINTPTR_MAX <= 0xFFFF)\r
+ #define UNITY_POINTER_WIDTH (16)\r
+ #elif (UINTPTR_MAX <= 0xFFFFFFFF)\r
+ #define UNITY_POINTER_WIDTH (32)\r
+ #elif (UINTPTR_MAX <= 0xFFFFFFFFFFFFFFFF)\r
+ #define UNITY_POINTER_WIDTH (64)\r
+ #endif\r
+ #endif\r
+#endif\r
+#ifndef UNITY_POINTER_WIDTH\r
+ #ifdef INTPTR_MAX\r
+ #if (INTPTR_MAX <= 0x7FFF)\r
+ #define UNITY_POINTER_WIDTH (16)\r
+ #elif (INTPTR_MAX <= 0x7FFFFFFF)\r
+ #define UNITY_POINTER_WIDTH (32)\r
+ #elif (INTPTR_MAX <= 0x7FFFFFFFFFFFFFFF)\r
+ #define UNITY_POINTER_WIDTH (64)\r
+ #endif\r
+ #endif\r
+#endif\r
+#ifndef UNITY_POINTER_WIDTH\r
+ #define UNITY_POINTER_WIDTH UNITY_LONG_WIDTH\r
+#endif\r
+\r
+//-------------------------------------------------------\r
+// Int Support (Define types based on detected sizes)\r
+//-------------------------------------------------------\r
+\r
+#if (UNITY_INT_WIDTH == 32)\r
+ typedef unsigned char _UU8;\r
+ typedef unsigned short _UU16;\r
+ typedef unsigned int _UU32;\r
+ typedef signed char _US8;\r
+ typedef signed short _US16;\r
+ typedef signed int _US32;\r
+#elif (UNITY_INT_WIDTH == 16)\r
+ typedef unsigned char _UU8;\r
+ typedef unsigned int _UU16;\r
+ typedef unsigned long _UU32;\r
+ typedef signed char _US8;\r
+ typedef signed int _US16;\r
+ typedef signed long _US32;\r
+#else\r
+ #error Invalid UNITY_INT_WIDTH specified! (16 or 32 are supported)\r
+#endif\r
+\r
+//-------------------------------------------------------\r
+// 64-bit Support\r
+//-------------------------------------------------------\r
+\r
+#ifndef UNITY_SUPPORT_64\r
+#if UNITY_LONG_WIDTH > 32\r
+#define UNITY_SUPPORT_64\r
+#endif\r
+#endif\r
+#ifndef UNITY_SUPPORT_64\r
+#if UNITY_POINTER_WIDTH > 32\r
+#define UNITY_SUPPORT_64\r
+#endif\r
+#endif\r
+\r
+#ifndef UNITY_SUPPORT_64\r
+\r
+//No 64-bit Support\r
+typedef _UU32 _U_UINT;\r
+typedef _US32 _U_SINT;\r
+\r
+#else\r
+\r
+//64-bit Support\r
+#if (UNITY_LONG_WIDTH == 32)\r
+ typedef unsigned long long _UU64;\r
+ typedef signed long long _US64;\r
+#elif (UNITY_LONG_WIDTH == 64)\r
+ typedef unsigned long _UU64;\r
+ typedef signed long _US64;\r
+#else\r
+ #error Invalid UNITY_LONG_WIDTH specified! (32 or 64 are supported)\r
+#endif\r
+typedef _UU64 _U_UINT;\r
+typedef _US64 _U_SINT;\r
+\r
+#endif\r
+\r
+//-------------------------------------------------------\r
+// Pointer Support\r
+//-------------------------------------------------------\r
+\r
+#if (UNITY_POINTER_WIDTH == 32)\r
+ typedef _UU32 _UP;\r
+#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX32\r
+#elif (UNITY_POINTER_WIDTH == 64)\r
+ typedef _UU64 _UP;\r
+#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX64\r
+#elif (UNITY_POINTER_WIDTH == 16)\r
+ typedef _UU16 _UP;\r
+#define UNITY_DISPLAY_STYLE_POINTER UNITY_DISPLAY_STYLE_HEX16\r
+#else\r
+ #error Invalid UNITY_POINTER_WIDTH specified! (16, 32 or 64 are supported)\r
+#endif\r
+\r
+#ifndef UNITY_PTR_ATTRIBUTE\r
+ #define UNITY_PTR_ATTRIBUTE\r
+#endif\r
+\r
+//-------------------------------------------------------\r
+// Float Support\r
+//-------------------------------------------------------\r
+\r
+#ifdef UNITY_EXCLUDE_FLOAT\r
+\r
+//No Floating Point Support\r
+#undef UNITY_INCLUDE_FLOAT\r
+#undef UNITY_FLOAT_PRECISION\r
+#undef UNITY_FLOAT_TYPE\r
+#undef UNITY_FLOAT_VERBOSE\r
+\r
+#else\r
+\r
+#ifndef UNITY_INCLUDE_FLOAT\r
+#define UNITY_INCLUDE_FLOAT\r
+#endif\r
+\r
+//Floating Point Support\r
+#ifndef UNITY_FLOAT_PRECISION\r
+#define UNITY_FLOAT_PRECISION (0.00001f)\r
+#endif\r
+#ifndef UNITY_FLOAT_TYPE\r
+#define UNITY_FLOAT_TYPE float\r
+#endif\r
+typedef UNITY_FLOAT_TYPE _UF;\r
+\r
+#endif\r
+\r
+//-------------------------------------------------------\r
+// Double Float Support\r
+//-------------------------------------------------------\r
+\r
+//unlike FLOAT, we DON'T include by default\r
+#ifndef UNITY_EXCLUDE_DOUBLE\r
+#ifndef UNITY_INCLUDE_DOUBLE\r
+#define UNITY_EXCLUDE_DOUBLE\r
+#endif\r
+#endif\r
+\r
+#ifdef UNITY_EXCLUDE_DOUBLE\r
+\r
+//No Floating Point Support\r
+#undef UNITY_DOUBLE_PRECISION\r
+#undef UNITY_DOUBLE_TYPE\r
+#undef UNITY_DOUBLE_VERBOSE\r
+\r
+#ifdef UNITY_INCLUDE_DOUBLE\r
+#undef UNITY_INCLUDE_DOUBLE\r
+#endif\r
+\r
+#else\r
+\r
+//Double Floating Point Support\r
+#ifndef UNITY_DOUBLE_PRECISION\r
+#define UNITY_DOUBLE_PRECISION (1e-12f)\r
+#endif\r
+#ifndef UNITY_DOUBLE_TYPE\r
+#define UNITY_DOUBLE_TYPE double\r
+#endif\r
+typedef UNITY_DOUBLE_TYPE _UD;\r
+\r
+#endif\r
+\r
+#ifdef UNITY_DOUBLE_VERBOSE\r
+#ifndef UNITY_FLOAT_VERBOSE\r
+#define UNITY_FLOAT_VERBOSE\r
+#endif\r
+#endif\r
+\r
+//-------------------------------------------------------\r
+// Output Method: stdout (DEFAULT)\r
+//-------------------------------------------------------\r
+#ifndef UNITY_OUTPUT_CHAR\r
+//Default to using putchar, which is defined in stdio.h\r
+#include <stdio.h>\r
+#define UNITY_OUTPUT_CHAR(a) putchar(a)\r
+#else\r
+//If defined as something else, make sure we declare it here so it's ready for use\r
+extern int UNITY_OUTPUT_CHAR(int);\r
+#endif\r
+\r
+#ifndef UNITY_OUTPUT_START\r
+#define UNITY_OUTPUT_START()\r
+#endif\r
+\r
+#ifndef UNITY_OUTPUT_COMPLETE\r
+#define UNITY_OUTPUT_COMPLETE()\r
+#endif\r
+\r
+//-------------------------------------------------------\r
+// Footprint\r
+//-------------------------------------------------------\r
+\r
+#ifndef UNITY_LINE_TYPE\r
+#define UNITY_LINE_TYPE _U_UINT\r
+#endif\r
+\r
+#ifndef UNITY_COUNTER_TYPE\r
+#define UNITY_COUNTER_TYPE _U_UINT\r
+#endif\r
+\r
+//-------------------------------------------------------\r
+// Language Features Available\r
+//-------------------------------------------------------\r
+\r
+#ifdef __GNUC__\r
+#define UNITY_SUPPORT_WEAK __attribute__((weak))\r
+#endif\r
+\r
+#ifdef __clang__\r
+#define UNITY_SUPPORT_WEAK __attribute__((weak))\r
+#endif\r
+\r
+#ifndef UNITY_WEAK\r
+#ifdef UNITY_SUPPORT_WEAK\r
+#define UNITY_WEAK UNITY_SUPPORT_WEAK\r
+#else\r
+#define UNITY_WEAK\r
+#endif\r
+#endif\r
+\r
+//-------------------------------------------------------\r
+// Internal Structs Needed\r
+//-------------------------------------------------------\r
+\r
+typedef void (*UnityTestFunction)(void);\r
+\r
+#define UNITY_DISPLAY_RANGE_INT (0x10)\r
+#define UNITY_DISPLAY_RANGE_UINT (0x20)\r
+#define UNITY_DISPLAY_RANGE_HEX (0x40)\r
+#define UNITY_DISPLAY_RANGE_AUTO (0x80)\r
+\r
+typedef enum\r
+{\r
+#if (UNITY_INT_WIDTH == 16)\r
+ UNITY_DISPLAY_STYLE_INT = 2 + UNITY_DISPLAY_RANGE_INT + UNITY_DISPLAY_RANGE_AUTO,\r
+#elif (UNITY_INT_WIDTH == 32)\r
+ UNITY_DISPLAY_STYLE_INT = 4 + UNITY_DISPLAY_RANGE_INT + UNITY_DISPLAY_RANGE_AUTO,\r
+#elif (UNITY_INT_WIDTH == 64)\r
+ UNITY_DISPLAY_STYLE_INT = 8 + UNITY_DISPLAY_RANGE_INT + UNITY_DISPLAY_RANGE_AUTO,\r
+#endif\r
+ UNITY_DISPLAY_STYLE_INT8 = 1 + UNITY_DISPLAY_RANGE_INT,\r
+ UNITY_DISPLAY_STYLE_INT16 = 2 + UNITY_DISPLAY_RANGE_INT,\r
+ UNITY_DISPLAY_STYLE_INT32 = 4 + UNITY_DISPLAY_RANGE_INT,\r
+#ifdef UNITY_SUPPORT_64\r
+ UNITY_DISPLAY_STYLE_INT64 = 8 + UNITY_DISPLAY_RANGE_INT,\r
+#endif\r
+\r
+#if (UNITY_INT_WIDTH == 16)\r
+ UNITY_DISPLAY_STYLE_UINT = 2 + UNITY_DISPLAY_RANGE_UINT + UNITY_DISPLAY_RANGE_AUTO,\r
+#elif (UNITY_INT_WIDTH == 32)\r
+ UNITY_DISPLAY_STYLE_UINT = 4 + UNITY_DISPLAY_RANGE_UINT + UNITY_DISPLAY_RANGE_AUTO,\r
+#elif (UNITY_INT_WIDTH == 64)\r
+ UNITY_DISPLAY_STYLE_UINT = 8 + UNITY_DISPLAY_RANGE_UINT + UNITY_DISPLAY_RANGE_AUTO,\r
+#endif\r
+ UNITY_DISPLAY_STYLE_UINT8 = 1 + UNITY_DISPLAY_RANGE_UINT,\r
+ UNITY_DISPLAY_STYLE_UINT16 = 2 + UNITY_DISPLAY_RANGE_UINT,\r
+ UNITY_DISPLAY_STYLE_UINT32 = 4 + UNITY_DISPLAY_RANGE_UINT,\r
+#ifdef UNITY_SUPPORT_64\r
+ UNITY_DISPLAY_STYLE_UINT64 = 8 + UNITY_DISPLAY_RANGE_UINT,\r
+#endif\r
+ UNITY_DISPLAY_STYLE_HEX8 = 1 + UNITY_DISPLAY_RANGE_HEX,\r
+ UNITY_DISPLAY_STYLE_HEX16 = 2 + UNITY_DISPLAY_RANGE_HEX,\r
+ UNITY_DISPLAY_STYLE_HEX32 = 4 + UNITY_DISPLAY_RANGE_HEX,\r
+#ifdef UNITY_SUPPORT_64\r
+ UNITY_DISPLAY_STYLE_HEX64 = 8 + UNITY_DISPLAY_RANGE_HEX,\r
+#endif\r
+ UNITY_DISPLAY_STYLE_UNKNOWN\r
+} UNITY_DISPLAY_STYLE_T;\r
+\r
+#ifndef UNITY_EXCLUDE_FLOAT\r
+typedef enum _UNITY_FLOAT_TRAIT_T\r
+{\r
+ UNITY_FLOAT_IS_NOT_INF = 0,\r
+ UNITY_FLOAT_IS_INF,\r
+ UNITY_FLOAT_IS_NOT_NEG_INF,\r
+ UNITY_FLOAT_IS_NEG_INF,\r
+ UNITY_FLOAT_IS_NOT_NAN,\r
+ UNITY_FLOAT_IS_NAN,\r
+ UNITY_FLOAT_IS_NOT_DET,\r
+ UNITY_FLOAT_IS_DET,\r
+} UNITY_FLOAT_TRAIT_T;\r
+#endif\r
+\r
+struct _Unity\r
+{\r
+ const char* TestFile;\r
+ const char* CurrentTestName;\r
+ UNITY_LINE_TYPE CurrentTestLineNumber;\r
+ UNITY_COUNTER_TYPE NumberOfTests;\r
+ UNITY_COUNTER_TYPE TestFailures;\r
+ UNITY_COUNTER_TYPE TestIgnores;\r
+ UNITY_COUNTER_TYPE CurrentTestFailed;\r
+ UNITY_COUNTER_TYPE CurrentTestIgnored;\r
+ jmp_buf AbortFrame;\r
+};\r
+\r
+extern struct _Unity Unity;\r
+\r
+//-------------------------------------------------------\r
+// Test Suite Management\r
+//-------------------------------------------------------\r
+\r
+void UnityBegin(const char* filename);\r
+int UnityEnd(void);\r
+void UnityConcludeTest(void);\r
+void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum);\r
+\r
+//-------------------------------------------------------\r
+// Test Output\r
+//-------------------------------------------------------\r
+\r
+void UnityPrint(const char* string);\r
+void UnityPrintMask(const _U_UINT mask, const _U_UINT number);\r
+void UnityPrintNumberByStyle(const _U_SINT number, const UNITY_DISPLAY_STYLE_T style);\r
+void UnityPrintNumber(const _U_SINT number);\r
+void UnityPrintNumberUnsigned(const _U_UINT number);\r
+void UnityPrintNumberHex(const _U_UINT number, const char nibbles);\r
+\r
+#ifdef UNITY_FLOAT_VERBOSE\r
+void UnityPrintFloat(const _UF number);\r
+#endif\r
+\r
+//-------------------------------------------------------\r
+// Test Assertion Fuctions\r
+//-------------------------------------------------------\r
+// Use the macros below this section instead of calling\r
+// these directly. The macros have a consistent naming\r
+// convention and will pull in file and line information\r
+// for you.\r
+\r
+void UnityAssertEqualNumber(const _U_SINT expected,\r
+ const _U_SINT actual,\r
+ const char* msg,\r
+ const UNITY_LINE_TYPE lineNumber,\r
+ const UNITY_DISPLAY_STYLE_T style);\r
+\r
+void UnityAssertEqualIntArray(UNITY_PTR_ATTRIBUTE const void* expected,\r
+ UNITY_PTR_ATTRIBUTE const void* actual,\r
+ const _UU32 num_elements,\r
+ const char* msg,\r
+ const UNITY_LINE_TYPE lineNumber,\r
+ const UNITY_DISPLAY_STYLE_T style);\r
+\r
+void UnityAssertBits(const _U_SINT mask,\r
+ const _U_SINT expected,\r
+ const _U_SINT actual,\r
+ const char* msg,\r
+ const UNITY_LINE_TYPE lineNumber);\r
+\r
+void UnityAssertEqualString(const char* expected,\r
+ const char* actual,\r
+ const char* msg,\r
+ const UNITY_LINE_TYPE lineNumber);\r
+\r
+void UnityAssertEqualStringArray( const char** expected,\r
+ const char** actual,\r
+ const _UU32 num_elements,\r
+ const char* msg,\r
+ const UNITY_LINE_TYPE lineNumber);\r
+\r
+void UnityAssertEqualMemory( UNITY_PTR_ATTRIBUTE const void* expected,\r
+ UNITY_PTR_ATTRIBUTE const void* actual,\r
+ const _UU32 length,\r
+ const _UU32 num_elements,\r
+ const char* msg,\r
+ const UNITY_LINE_TYPE lineNumber);\r
+\r
+void UnityAssertNumbersWithin(const _U_SINT delta,\r
+ const _U_SINT expected,\r
+ const _U_SINT actual,\r
+ const char* msg,\r
+ const UNITY_LINE_TYPE lineNumber,\r
+ const UNITY_DISPLAY_STYLE_T style);\r
+\r
+void UnityFail(const char* message, const UNITY_LINE_TYPE line);\r
+\r
+void UnityIgnore(const char* message, const UNITY_LINE_TYPE line);\r
+\r
+#ifndef UNITY_EXCLUDE_FLOAT\r
+void UnityAssertFloatsWithin(const _UF delta,\r
+ const _UF expected,\r
+ const _UF actual,\r
+ const char* msg,\r
+ const UNITY_LINE_TYPE lineNumber);\r
+\r
+void UnityAssertEqualFloatArray(UNITY_PTR_ATTRIBUTE const _UF* expected,\r
+ UNITY_PTR_ATTRIBUTE const _UF* actual,\r
+ const _UU32 num_elements,\r
+ const char* msg,\r
+ const UNITY_LINE_TYPE lineNumber);\r
+\r
+void UnityAssertFloatSpecial(const _UF actual,\r
+ const char* msg,\r
+ const UNITY_LINE_TYPE lineNumber,\r
+ const UNITY_FLOAT_TRAIT_T style);\r
+#endif\r
+\r
+#ifndef UNITY_EXCLUDE_DOUBLE\r
+void UnityAssertDoublesWithin(const _UD delta,\r
+ const _UD expected,\r
+ const _UD actual,\r
+ const char* msg,\r
+ const UNITY_LINE_TYPE lineNumber);\r
+\r
+void UnityAssertEqualDoubleArray(UNITY_PTR_ATTRIBUTE const _UD* expected,\r
+ UNITY_PTR_ATTRIBUTE const _UD* actual,\r
+ const _UU32 num_elements,\r
+ const char* msg,\r
+ const UNITY_LINE_TYPE lineNumber);\r
+\r
+void UnityAssertDoubleSpecial(const _UD actual,\r
+ const char* msg,\r
+ const UNITY_LINE_TYPE lineNumber,\r
+ const UNITY_FLOAT_TRAIT_T style);\r
+#endif\r
+\r
+//-------------------------------------------------------\r
+// Error Strings We Might Need\r
+//-------------------------------------------------------\r
+\r
+extern const char UnityStrErrFloat[];\r
+extern const char UnityStrErrDouble[];\r
+extern const char UnityStrErr64[];\r
+\r
+//-------------------------------------------------------\r
+// Test Running Macros\r
+//-------------------------------------------------------\r
+\r
+#define TEST_PROTECT() (setjmp(Unity.AbortFrame) == 0)\r
+\r
+#define TEST_ABORT() {longjmp(Unity.AbortFrame, 1);}\r
+\r
+//This tricky series of macros gives us an optional line argument to treat it as RUN_TEST(func, num=__LINE__)\r
+#ifndef RUN_TEST\r
+#ifdef __STDC_VERSION__\r
+#if __STDC_VERSION__ >= 199901L\r
+#define RUN_TEST(...) UnityDefaultTestRun(RUN_TEST_FIRST(__VA_ARGS__), RUN_TEST_SECOND(__VA_ARGS__))\r
+#define RUN_TEST_FIRST(...) RUN_TEST_FIRST_HELPER(__VA_ARGS__, throwaway)\r
+#define RUN_TEST_FIRST_HELPER(first,...) first, #first\r
+#define RUN_TEST_SECOND(...) RUN_TEST_SECOND_HELPER(__VA_ARGS__, __LINE__, throwaway)\r
+#define RUN_TEST_SECOND_HELPER(first,second,...) second\r
+#endif\r
+#endif\r
+#endif\r
+\r
+//If we can't do the tricky version, we'll just have to require them to always include the line number\r
+#ifndef RUN_TEST\r
+#ifdef CMOCK\r
+#define RUN_TEST(func, num) UnityDefaultTestRun(func, #func, num)\r
+#else\r
+#define RUN_TEST(func) UnityDefaultTestRun(func, #func, __LINE__)\r
+#endif\r
+#endif\r
+\r
+#define TEST_LINE_NUM (Unity.CurrentTestLineNumber)\r
+#define TEST_IS_IGNORED (Unity.CurrentTestIgnored)\r
+#define UNITY_NEW_TEST(a) \\r
+ Unity.CurrentTestName = a; \\r
+ Unity.CurrentTestLineNumber = (UNITY_LINE_TYPE)(__LINE__); \\r
+ Unity.NumberOfTests++;\r
+\r
+#ifndef UNITY_BEGIN\r
+#define UNITY_BEGIN() UnityBegin(__FILE__)\r
+#endif\r
+\r
+#ifndef UNITY_END\r
+#define UNITY_END() UnityEnd()\r
+#endif\r
+\r
+//-------------------------------------------------------\r
+// Basic Fail and Ignore\r
+//-------------------------------------------------------\r
+\r
+#define UNITY_TEST_FAIL(line, message) UnityFail( (message), (UNITY_LINE_TYPE)line);\r
+#define UNITY_TEST_IGNORE(line, message) UnityIgnore( (message), (UNITY_LINE_TYPE)line);\r
+\r
+//-------------------------------------------------------\r
+// Test Asserts\r
+//-------------------------------------------------------\r
+\r
+#define UNITY_TEST_ASSERT(condition, line, message) if (condition) {} else {UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, message);}\r
+#define UNITY_TEST_ASSERT_NULL(pointer, line, message) UNITY_TEST_ASSERT(((pointer) == NULL), (UNITY_LINE_TYPE)line, message)\r
+#define UNITY_TEST_ASSERT_NOT_NULL(pointer, line, message) UNITY_TEST_ASSERT(((pointer) != NULL), (UNITY_LINE_TYPE)line, message)\r
+\r
+#define UNITY_TEST_ASSERT_EQUAL_INT(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT)\r
+#define UNITY_TEST_ASSERT_EQUAL_INT8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(_US8 )(expected), (_U_SINT)(_US8 )(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT8)\r
+#define UNITY_TEST_ASSERT_EQUAL_INT16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(_US16)(expected), (_U_SINT)(_US16)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT16)\r
+#define UNITY_TEST_ASSERT_EQUAL_INT32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(_US32)(expected), (_U_SINT)(_US32)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT32)\r
+#define UNITY_TEST_ASSERT_EQUAL_UINT(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT)\r
+#define UNITY_TEST_ASSERT_EQUAL_UINT8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(_UU8 )(expected), (_U_SINT)(_UU8 )(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT8)\r
+#define UNITY_TEST_ASSERT_EQUAL_UINT16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(_UU16)(expected), (_U_SINT)(_UU16)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT16)\r
+#define UNITY_TEST_ASSERT_EQUAL_UINT32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(_UU32)(expected), (_U_SINT)(_UU32)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT32)\r
+#define UNITY_TEST_ASSERT_EQUAL_HEX8(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(_US8 )(expected), (_U_SINT)(_US8 )(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX8)\r
+#define UNITY_TEST_ASSERT_EQUAL_HEX16(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(_US16)(expected), (_U_SINT)(_US16)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX16)\r
+#define UNITY_TEST_ASSERT_EQUAL_HEX32(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(_US32)(expected), (_U_SINT)(_US32)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX32)\r
+#define UNITY_TEST_ASSERT_BITS(mask, expected, actual, line, message) UnityAssertBits((_U_SINT)(mask), (_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line)\r
+\r
+#define UNITY_TEST_ASSERT_INT_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT)\r
+#define UNITY_TEST_ASSERT_INT8_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(_US8 )(delta), (_U_SINT)(_US8 )(expected), (_U_SINT)(_US8 )(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT8)\r
+#define UNITY_TEST_ASSERT_INT16_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(_US16)(delta), (_U_SINT)(_US16)(expected), (_U_SINT)(_US16)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT16)\r
+#define UNITY_TEST_ASSERT_INT32_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(_US32)(delta), (_U_SINT)(_US32)(expected), (_U_SINT)(_US32)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT32)\r
+#define UNITY_TEST_ASSERT_UINT_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT)\r
+#define UNITY_TEST_ASSERT_UINT8_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(_U_UINT)(_UU8 )(delta), (_U_SINT)(_U_UINT)(_UU8 )(expected), (_U_SINT)(_U_UINT)(_UU8 )(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT8)\r
+#define UNITY_TEST_ASSERT_UINT16_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(_U_UINT)(_UU16)(delta), (_U_SINT)(_U_UINT)(_UU16)(expected), (_U_SINT)(_U_UINT)(_UU16)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT16)\r
+#define UNITY_TEST_ASSERT_UINT32_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(_U_UINT)(_UU32)(delta), (_U_SINT)(_U_UINT)(_UU32)(expected), (_U_SINT)(_U_UINT)(_UU32)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT32)\r
+#define UNITY_TEST_ASSERT_HEX8_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(_U_UINT)(_UU8 )(delta), (_U_SINT)(_U_UINT)(_UU8 )(expected), (_U_SINT)(_U_UINT)(_UU8 )(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX8)\r
+#define UNITY_TEST_ASSERT_HEX16_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(_U_UINT)(_UU16)(delta), (_U_SINT)(_U_UINT)(_UU16)(expected), (_U_SINT)(_U_UINT)(_UU16)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX16)\r
+#define UNITY_TEST_ASSERT_HEX32_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(_U_UINT)(_UU32)(delta), (_U_SINT)(_U_UINT)(_UU32)(expected), (_U_SINT)(_U_UINT)(_UU32)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX32)\r
+\r
+#define UNITY_TEST_ASSERT_EQUAL_PTR(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(_UP)(expected), (_U_SINT)(_UP)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_POINTER)\r
+#define UNITY_TEST_ASSERT_EQUAL_STRING(expected, actual, line, message) UnityAssertEqualString((const char*)(expected), (const char*)(actual), (message), (UNITY_LINE_TYPE)line)\r
+#define UNITY_TEST_ASSERT_EQUAL_MEMORY(expected, actual, len, line, message) UnityAssertEqualMemory((UNITY_PTR_ATTRIBUTE void*)(expected), (UNITY_PTR_ATTRIBUTE void*)(actual), (_UU32)(len), 1, (message), (UNITY_LINE_TYPE)line)\r
+\r
+#define UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_PTR_ATTRIBUTE const void*)(expected), (UNITY_PTR_ATTRIBUTE const void*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT)\r
+#define UNITY_TEST_ASSERT_EQUAL_INT8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_PTR_ATTRIBUTE const void*)(expected), (UNITY_PTR_ATTRIBUTE const void*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT8)\r
+#define UNITY_TEST_ASSERT_EQUAL_INT16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_PTR_ATTRIBUTE const void*)(expected), (UNITY_PTR_ATTRIBUTE const void*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT16)\r
+#define UNITY_TEST_ASSERT_EQUAL_INT32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_PTR_ATTRIBUTE const void*)(expected), (UNITY_PTR_ATTRIBUTE const void*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT32)\r
+#define UNITY_TEST_ASSERT_EQUAL_UINT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_PTR_ATTRIBUTE const void*)(expected), (UNITY_PTR_ATTRIBUTE const void*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT)\r
+#define UNITY_TEST_ASSERT_EQUAL_UINT8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_PTR_ATTRIBUTE const void*)(expected), (UNITY_PTR_ATTRIBUTE const void*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT8)\r
+#define UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_PTR_ATTRIBUTE const void*)(expected), (UNITY_PTR_ATTRIBUTE const void*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT16)\r
+#define UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_PTR_ATTRIBUTE const void*)(expected), (UNITY_PTR_ATTRIBUTE const void*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT32)\r
+#define UNITY_TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_PTR_ATTRIBUTE const void*)(expected), (UNITY_PTR_ATTRIBUTE const void*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX8)\r
+#define UNITY_TEST_ASSERT_EQUAL_HEX16_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_PTR_ATTRIBUTE const void*)(expected), (UNITY_PTR_ATTRIBUTE const void*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX16)\r
+#define UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_PTR_ATTRIBUTE const void*)(expected), (UNITY_PTR_ATTRIBUTE const void*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX32)\r
+#define UNITY_TEST_ASSERT_EQUAL_PTR_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_PTR_ATTRIBUTE const void*)(_UP*)(expected), (const void*)(_UP*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_POINTER)\r
+#define UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualStringArray((const char**)(expected), (const char**)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line)\r
+#define UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY(expected, actual, len, num_elements, line, message) UnityAssertEqualMemory((UNITY_PTR_ATTRIBUTE void*)(expected), (UNITY_PTR_ATTRIBUTE void*)(actual), (_UU32)(len), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line)\r
+\r
+#ifdef UNITY_SUPPORT_64\r
+#define UNITY_TEST_ASSERT_EQUAL_INT64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT64)\r
+#define UNITY_TEST_ASSERT_EQUAL_UINT64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT64)\r
+#define UNITY_TEST_ASSERT_EQUAL_HEX64(expected, actual, line, message) UnityAssertEqualNumber((_U_SINT)(expected), (_U_SINT)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX64)\r
+#define UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_PTR_ATTRIBUTE const _U_SINT*)(expected), (UNITY_PTR_ATTRIBUTE const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT64)\r
+#define UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_PTR_ATTRIBUTE const _U_SINT*)(expected), (UNITY_PTR_ATTRIBUTE const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT64)\r
+#define UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualIntArray((UNITY_PTR_ATTRIBUTE const _U_SINT*)(expected), (UNITY_PTR_ATTRIBUTE const _U_SINT*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX64)\r
+#define UNITY_TEST_ASSERT_INT64_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_INT64)\r
+#define UNITY_TEST_ASSERT_UINT64_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_UINT64)\r
+#define UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, line, message) UnityAssertNumbersWithin((_U_SINT)(delta), (_U_SINT)(expected), (_U_SINT)(actual), NULL, (UNITY_LINE_TYPE)line, UNITY_DISPLAY_STYLE_HEX64)\r
+#else\r
+#define UNITY_TEST_ASSERT_EQUAL_INT64(expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, UnityStrErr64)\r
+#define UNITY_TEST_ASSERT_EQUAL_UINT64(expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, UnityStrErr64)\r
+#define UNITY_TEST_ASSERT_EQUAL_HEX64(expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, UnityStrErr64)\r
+#define UNITY_TEST_ASSERT_EQUAL_INT64_ARRAY(expected, actual, num_elements, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, UnityStrErr64)\r
+#define UNITY_TEST_ASSERT_EQUAL_UINT64_ARRAY(expected, actual, num_elements, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, UnityStrErr64)\r
+#define UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY(expected, actual, num_elements, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, UnityStrErr64)\r
+#define UNITY_TEST_ASSERT_INT64_WITHIN(delta, expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, UnityStrErr64)\r
+#define UNITY_TEST_ASSERT_UINT64_WITHIN(delta, expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, UnityStrErr64)\r
+#define UNITY_TEST_ASSERT_HEX64_WITHIN(delta, expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, UnityStrErr64)\r
+#endif\r
+\r
+#ifdef UNITY_EXCLUDE_FLOAT\r
+#define UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, UnityStrErrFloat)\r
+#define UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, UnityStrErrFloat)\r
+#define UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, UnityStrErrFloat)\r
+#define UNITY_TEST_ASSERT_FLOAT_IS_INF(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, UnityStrErrFloat)\r
+#define UNITY_TEST_ASSERT_FLOAT_IS_NEG_INF(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, UnityStrErrFloat)\r
+#define UNITY_TEST_ASSERT_FLOAT_IS_NAN(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, UnityStrErrFloat)\r
+#define UNITY_TEST_ASSERT_FLOAT_IS_DETERMINATE(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, UnityStrErrFloat)\r
+#define UNITY_TEST_ASSERT_FLOAT_IS_NOT_INF(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, UnityStrErrFloat)\r
+#define UNITY_TEST_ASSERT_FLOAT_IS_NOT_NEG_INF(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, UnityStrErrFloat)\r
+#define UNITY_TEST_ASSERT_FLOAT_IS_NOT_NAN(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, UnityStrErrFloat)\r
+#define UNITY_TEST_ASSERT_FLOAT_IS_NOT_DETERMINATE(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, UnityStrErrFloat)\r
+#else\r
+#define UNITY_TEST_ASSERT_FLOAT_WITHIN(delta, expected, actual, line, message) UnityAssertFloatsWithin((_UF)(delta), (_UF)(expected), (_UF)(actual), (message), (UNITY_LINE_TYPE)line)\r
+#define UNITY_TEST_ASSERT_EQUAL_FLOAT(expected, actual, line, message) UNITY_TEST_ASSERT_FLOAT_WITHIN((_UF)(expected) * (_UF)UNITY_FLOAT_PRECISION, (_UF)expected, (_UF)actual, (UNITY_LINE_TYPE)line, message)\r
+#define UNITY_TEST_ASSERT_EQUAL_FLOAT_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualFloatArray((_UF*)(expected), (_UF*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line)\r
+#define UNITY_TEST_ASSERT_FLOAT_IS_INF(actual, line, message) UnityAssertFloatSpecial((_UF)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_FLOAT_IS_INF)\r
+#define UNITY_TEST_ASSERT_FLOAT_IS_NEG_INF(actual, line, message) UnityAssertFloatSpecial((_UF)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_FLOAT_IS_NEG_INF)\r
+#define UNITY_TEST_ASSERT_FLOAT_IS_NAN(actual, line, message) UnityAssertFloatSpecial((_UF)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_FLOAT_IS_NAN)\r
+#define UNITY_TEST_ASSERT_FLOAT_IS_DETERMINATE(actual, line, message) UnityAssertFloatSpecial((_UF)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_FLOAT_IS_DET)\r
+#define UNITY_TEST_ASSERT_FLOAT_IS_NOT_INF(actual, line, message) UnityAssertFloatSpecial((_UF)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_FLOAT_IS_NOT_INF)\r
+#define UNITY_TEST_ASSERT_FLOAT_IS_NOT_NEG_INF(actual, line, message) UnityAssertFloatSpecial((_UF)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_FLOAT_IS_NOT_NEG_INF)\r
+#define UNITY_TEST_ASSERT_FLOAT_IS_NOT_NAN(actual, line, message) UnityAssertFloatSpecial((_UF)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_FLOAT_IS_NOT_NAN)\r
+#define UNITY_TEST_ASSERT_FLOAT_IS_NOT_DETERMINATE(actual, line, message) UnityAssertFloatSpecial((_UF)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_FLOAT_IS_NOT_DET)\r
+#endif\r
+\r
+#ifdef UNITY_EXCLUDE_DOUBLE\r
+#define UNITY_TEST_ASSERT_DOUBLE_WITHIN(delta, expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, UnityStrErrDouble)\r
+#define UNITY_TEST_ASSERT_EQUAL_DOUBLE(expected, actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, UnityStrErrDouble)\r
+#define UNITY_TEST_ASSERT_EQUAL_DOUBLE_ARRAY(expected, actual, num_elements, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, UnityStrErrDouble)\r
+#define UNITY_TEST_ASSERT_DOUBLE_IS_INF(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, UnityStrErrDouble)\r
+#define UNITY_TEST_ASSERT_DOUBLE_IS_NEG_INF(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, UnityStrErrDouble)\r
+#define UNITY_TEST_ASSERT_DOUBLE_IS_NAN(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, UnityStrErrDouble)\r
+#define UNITY_TEST_ASSERT_DOUBLE_IS_DETERMINATE(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, UnityStrErrDouble)\r
+#define UNITY_TEST_ASSERT_DOUBLE_IS_NOT_INF(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, UnityStrErrDouble)\r
+#define UNITY_TEST_ASSERT_DOUBLE_IS_NOT_NEG_INF(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, UnityStrErrDouble)\r
+#define UNITY_TEST_ASSERT_DOUBLE_IS_NOT_NAN(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, UnityStrErrDouble)\r
+#define UNITY_TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE(actual, line, message) UNITY_TEST_FAIL((UNITY_LINE_TYPE)line, UnityStrErrDouble)\r
+#else\r
+#define UNITY_TEST_ASSERT_DOUBLE_WITHIN(delta, expected, actual, line, message) UnityAssertDoublesWithin((_UD)(delta), (_UD)(expected), (_UD)(actual), (message), (UNITY_LINE_TYPE)line)\r
+#define UNITY_TEST_ASSERT_EQUAL_DOUBLE(expected, actual, line, message) UNITY_TEST_ASSERT_DOUBLE_WITHIN((_UD)(expected) * (_UD)UNITY_DOUBLE_PRECISION, (_UD)expected, (_UD)actual, (UNITY_LINE_TYPE)line, message)\r
+#define UNITY_TEST_ASSERT_EQUAL_DOUBLE_ARRAY(expected, actual, num_elements, line, message) UnityAssertEqualDoubleArray((_UD*)(expected), (_UD*)(actual), (_UU32)(num_elements), (message), (UNITY_LINE_TYPE)line)\r
+#define UNITY_TEST_ASSERT_DOUBLE_IS_INF(actual, line, message) UnityAssertDoubleSpecial((_UD)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_FLOAT_IS_INF)\r
+#define UNITY_TEST_ASSERT_DOUBLE_IS_NEG_INF(actual, line, message) UnityAssertDoubleSpecial((_UD)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_FLOAT_IS_NEG_INF)\r
+#define UNITY_TEST_ASSERT_DOUBLE_IS_NAN(actual, line, message) UnityAssertDoubleSpecial((_UD)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_FLOAT_IS_NAN)\r
+#define UNITY_TEST_ASSERT_DOUBLE_IS_DETERMINATE(actual, line, message) UnityAssertDoubleSpecial((_UD)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_FLOAT_IS_DET)\r
+#define UNITY_TEST_ASSERT_DOUBLE_IS_NOT_INF(actual, line, message) UnityAssertDoubleSpecial((_UD)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_FLOAT_IS_NOT_INF)\r
+#define UNITY_TEST_ASSERT_DOUBLE_IS_NOT_NEG_INF(actual, line, message) UnityAssertDoubleSpecial((_UD)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_FLOAT_IS_NOT_NEG_INF)\r
+#define UNITY_TEST_ASSERT_DOUBLE_IS_NOT_NAN(actual, line, message) UnityAssertDoubleSpecial((_UD)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_FLOAT_IS_NOT_NAN)\r
+#define UNITY_TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE(actual, line, message) UnityAssertDoubleSpecial((_UD)(actual), (message), (UNITY_LINE_TYPE)line, UNITY_FLOAT_IS_NOT_DET)\r
+#endif\r
+\r
+//End of UNITY_INTERNALS_H\r
+#endif\r