aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/ar71xx/files/arch
Commit message (Collapse)AuthorAgeFilesLines
...
* ar71xx: remove the built-in MTD maps of several boardsGabor Juhos2012-03-278-324/+8
| | | | | | | | | | | | | | | | | | | We are passing the MTD layout via the kernel command line, so it makes no sense to duplicate it in mach-* files. The patch removes the built-in MTD maps of the following boards: * AP113 * ALFA N2/N5 * DIR-600 * DIR-615 * DIR-825 * TEW-6{3,5}2BRP * TEW-673GRU * WHR-G301N * WHR-HP-GN * WHR-HP-G300N SVN-Revision: 31108
* ar71xx: fix button polarity on TL-WR703N and TL-WR741N v4Gabor Juhos2012-03-272-3/+3
| | | | SVN-Revision: 31102
* ar71xx: add initial support for RB750GLGabor Juhos2012-03-192-0/+125
| | | | SVN-Revision: 31025
* ar71xx: make rb750_latch_change 'static void'Gabor Juhos2012-03-192-15/+3
| | | | SVN-Revision: 31024
* ar71xx: add latch_change field to rb750_led_platform_dataGabor Juhos2012-03-192-5/+5
| | | | SVN-Revision: 31023
* ar71xx: add platform data for the RB750 NAND driverGabor Juhos2012-03-192-7/+28
| | | | SVN-Revision: 31022
* ar71xx: add AR934x specific interface speed setup for ge0Gabor Juhos2012-03-191-4/+9
| | | | SVN-Revision: 31017
* ar71xx: add support for the jjPlus JA76PF2 boardGabor Juhos2012-03-161-0/+76
| | | | SVN-Revision: 30957
* ar71xx: change LED name prefix on the jjplus boardsGabor Juhos2012-03-161-3/+3
| | | | SVN-Revision: 30956
* ar71xx: reset the switch on AR934x before ethernet device registrationGabor Juhos2012-03-131-0/+4
| | | | SVN-Revision: 30922
* ar71xx: use a dummy callback for interfaces with fixed speedGabor Juhos2012-03-121-28/+7
| | | | SVN-Revision: 30913
* ar71xx: merge ar934x_bo_ddr_flush patchGabor Juhos2012-03-121-12/+5
| | | | SVN-Revision: 30912
* ar71xx: fix WPS button polarity on TL-WR2543NGabor Juhos2012-03-071-0/+1
| | | | SVN-Revision: 30849
* ar71xx: merge files-3.2 to filesGabor Juhos2012-02-1065-0/+9472
| | | | SVN-Revision: 30405
* ar71xx: move arch specific files to files-2.6.39Gabor Juhos2012-01-22104-15552/+0
| | | | SVN-Revision: 29867
* ar71xx: change board id of the UniFi boardGabor Juhos2012-01-221-1/+1
| | | | SVN-Revision: 29849
* ar71xx: move irq_to_gpio and gpio_to_irq into gpio.cGabor Juhos2012-01-112-12/+14
| | | | SVN-Revision: 29713
* ar71xx: add initial support for the TL-WR2543N/ND boardGabor Juhos2012-01-074-0/+140
| | | | | | The WLAN LEDs are not working yet. SVN-Revision: 29680
* ar71xx: local mac support on the wndr3700Gabor Juhos2012-01-071-2/+13
| | | | | | | | | | | | | | The wndr3700 at least has no eth0 mac address and usually leverages the first wireless device's mac when in a bridged scenario. If, however, you want to route, and not bridge the interfaces, you need a unique mac address for it. This patch sets the local bit on the mac address pulled from the wireless chip and uses the resulting address for eth0. Patch-by: Dave Taht <dave.taht@gmail.com> SVN-Revision: 29675
* ar71xx: add support for Redwave RW2458NGabor Juhos2012-01-064-0/+112
| | | | | | Signed-off-by: Cezary Jackiewicz <cezary.jackiewicz@gmail.com> SVN-Revision: 29669
* ar71xx: add inital support for the ALFA Network AP96 boardGabor Juhos2012-01-044-0/+165
| | | | | | | | The microSD slot and the Real Time Clock is not working yet. The miniPCIe interface is not tested due to the lack of a suitable card. SVN-Revision: 29662
* ar71xx: allow to use the command line hack on compex devicesGabor Juhos2012-01-041-29/+31
| | | | SVN-Revision: 29659
* ar71xx: use the TL-MR3x20 code for the TL-WR841N/ND v7Gabor Juhos2012-01-042-12/+33
| | | | | | | These models are based on the AP99 reference board, and uses the AR7241 SoC. SVN-Revision: 29658
* ar71xx: allow to use LAN LED on the TL-WA901N/ND boardsGabor Juhos2012-01-041-0/+11
| | | | SVN-Revision: 29653
* ar71xx: add support for TP-Link TL-MR3020Gabor Juhos2012-01-044-0/+133
| | | | | | | | | | | | | | | | | | | | | | | | This patch adds support for the TP-Link device TL-MR3020 which is very similiar to the TL-WR703N. The TL-MR3020 uses 5 LEDs, 1 push button and a switch with 3 positions. Only four LEDs can be controlled via GPIO. The power LED is connected to the power supply. The WPS push button has been mapped to KEY_WPS_BUTTON. The two GPIO signals of the sliding switch have been mapped to BTN_0 and BTN_1. I have also setup a wiki page with details here: http://wiki.openwrt.org/toh/tp-link/tl-mr3020 USB is working and has been tested with USB mass storage and USB UMTS stick. Wifi also seems to work. Ethernet is working too. Signed-off-by: Christian Cier-Zniewski <c.cier@gmx.de> SVN-Revision: 29651
* ar71xx: add support for the ALFA Network N2/N5 boardsGabor Juhos2012-01-014-0/+169
| | | | SVN-Revision: 29635
* ar71xx: define LAN/WAN LEDs for the TL-WR741N/ND boardsGabor Juhos2011-12-312-5/+68
| | | | SVN-Revision: 29631
* ar71xx: fix LEDs on the WRT400NGabor Juhos2011-12-311-11/+12
| | | | SVN-Revision: 29624
* the mach file of the WZR-HP-G300NH2 accidentally claimed the mach id of the ↵Jo-Philipp Wich2011-12-211-1/+1
| | | | | | WZR-HP-AG300H, correct the id (#10649) SVN-Revision: 29593
* ar71xx: add missing wireless led changes for wzr-hp-g300nh2Felix Fietkau2011-12-191-6/+1
| | | | SVN-Revision: 29568
* ar71xx: add support for the wzr-hp-g300nh2Felix Fietkau2011-12-184-0/+206
| | | | | | Signed-off-by: Mark Deneen <mdeneen@gmail.com> SVN-Revision: 29567
* ar71xx: connect GMAC0 to the internal switch on DB120Gabor Juhos2011-12-151-1/+29
| | | | | | | | Because the external switch has no driver yet, connect GMAC0 to the PHY4 of the internal switch for now. This allows to use the DB120 board as a router with 4LAN+1WAN ports. SVN-Revision: 29557
* ar71xx: add defines for the AR934X GMAC interfaceGabor Juhos2011-12-151-0/+21
| | | | SVN-Revision: 29556
* ar71xx: fix GMAC1 interface speed on the DB120 boardGabor Juhos2011-12-151-1/+1
| | | | SVN-Revision: 29555
* ar71xx: ag71xx: allow to connect PHY4 to the CPU on AR934XGabor Juhos2011-12-151-1/+1
| | | | SVN-Revision: 29553
* ar71xx: allow to attach the internal switch for AR934xGabor Juhos2011-12-151-0/+2
| | | | SVN-Revision: 29550
* ar71xx: introduce ar71xx_switch_dataGabor Juhos2011-12-153-3/+12
| | | | SVN-Revision: 29549
* ar71xx: fix mac addresses on jjPlus devicesGabor Juhos2011-12-152-0/+4
| | | | SVN-Revision: 29538
* ar71xx: add support for ALFA Network's Hornet-UB boardGabor Juhos2011-12-144-0/+145
| | | | SVN-Revision: 29535
* ar71xx: add GPIO function bit defines for AR933XGabor Juhos2011-12-141-0/+21
| | | | SVN-Revision: 29534
* ar71xx: fix gpio count for ar7241/ar7242Felix Fietkau2011-12-142-2/+6
| | | | SVN-Revision: 29532
* ar71xx: register extra leds behind the wireless mac on wzr-hp-g450hFelix Fietkau2011-12-143-0/+26
| | | | SVN-Revision: 29531
* ar71xx: fix wireless led on wzr-hp-g450hFelix Fietkau2011-12-131-0/+1
| | | | SVN-Revision: 29515
* ar71xx: enable AR9341 support at setup.cGabor Juhos2011-12-131-0/+6
| | | | | | Patch-by: dyq <729650915@qq.com> SVN-Revision: 29514
* ar71xx: Build images for Netgear WNDRMAC and WNDRMACv2Gabor Juhos2011-12-132-2/+3
| | | | | | | | | | | | | | | | | | | The WNDRMAC is a WNDR3700v2 (64MB RAM, 16MB flash) in a white case. The WNDRMACv2 is a WNDR3800 (128MB RAM, 16MB flash) in a WNDRMAC case. The WNDRMAC case doesn't have "holes" or labels for the 2.4GHz LED or switch ports 2-4. The stock firmware uses a single LED (in the 5GHz position) to indicate the status of both radios, and a single LED (in the switch port 1 position) to indicate the status of all LAN ports. The "missing" LEDs are present on the board, and easily shine through the case. Unlike the stock firmware, OpenWrt will use these "hidden" LEDs. I've tested the WNDRMACv2 image. I don't have a v1 WNDRMAC, but assume that this is sufficient to build a fully-functional image. Signed-off-by: Mark Mentovai <mark@moxienet.com> SVN-Revision: 29513
* ar71xx: add gpios and usb for wzr-hp-g450hFelix Fietkau2011-12-131-2/+73
| | | | SVN-Revision: 29509
* ar71xx: use RedBoot parser on PB44Gabor Juhos2011-12-111-0/+10
| | | | SVN-Revision: 29501
* ar71xx: use correct mac on the lan interface on several TP-LINK devicesGabor Juhos2011-12-053-6/+6
| | | | SVN-Revision: 29458
* ar71xx: allow to pass negative offset values for ar71xx_init_macGabor Juhos2011-12-052-3/+3
| | | | SVN-Revision: 29457
* ar71xx: don't register PCI controller on AR934x if PCIE_RC bit is not setGabor Juhos2011-12-051-2/+7
| | | | SVN-Revision: 29456
180' href='#n1180'>1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600
# Advanced googletest Topics

<!-- GOOGLETEST_CM0016 DO NOT DELETE -->

## Introduction

Now that you have read the [googletest Primer](primer.md) and learned how to
write tests using googletest, it's time to learn some new tricks. This document
will show you more assertions as well as how to construct complex failure
messages, propagate fatal failures, reuse and speed up your test fixtures, and
use various flags with your tests.

## More Assertions

This section covers some less frequently used, but still significant,
assertions.

### Explicit Success and Failure

These three assertions do not actually test a value or expression. Instead, they
generate a success or failure directly. Like the macros that actually perform a
test, you may stream a custom failure message into them.

```c++
SUCCEED();
```

Generates a success. This does **NOT** make the overall test succeed. A test is
considered successful only if none of its assertions fail during its execution.

NOTE: `SUCCEED()` is purely documentary and currently doesn't generate any
user-visible output. However, we may add `SUCCEED()` messages to googletest's
output in the future.

```c++
FAIL();
ADD_FAILURE();
ADD_FAILURE_AT("file_path", line_number);
```

`FAIL()` generates a fatal failure, while `ADD_FAILURE()` and `ADD_FAILURE_AT()`
generate a nonfatal failure. These are useful when control flow, rather than a
Boolean expression, determines the test's success or failure. For example, you
might want to write something like:

```c++
switch(expression) {
  case 1:
     ... some checks ...
  case 2:
     ... some other checks ...
  default:
     FAIL() << "We shouldn't get here.";
}
```

NOTE: you can only use `FAIL()` in functions that return `void`. See the
[Assertion Placement section](#assertion-placement) for more information.

### Exception Assertions

These are for verifying that a piece of code throws (or does not throw) an
exception of the given type:

Fatal assertion                            | Nonfatal assertion                         | Verifies
------------------------------------------ | ------------------------------------------ | --------
`ASSERT_THROW(statement, exception_type);` | `EXPECT_THROW(statement, exception_type);` | `statement` throws an exception of the given type
`ASSERT_ANY_THROW(statement);`             | `EXPECT_ANY_THROW(statement);`             | `statement` throws an exception of any type
`ASSERT_NO_THROW(statement);`              | `EXPECT_NO_THROW(statement);`              | `statement` doesn't throw any exception

Examples:

```c++
ASSERT_THROW(Foo(5), bar_exception);

EXPECT_NO_THROW({
  int n = 5;
  Bar(&n);
});
```

**Availability**: requires exceptions to be enabled in the build environment

### Predicate Assertions for Better Error Messages

Even though googletest has a rich set of assertions, they can never be complete,
as it's impossible (nor a good idea) to anticipate all scenarios a user might
run into. Therefore, sometimes a user has to use `EXPECT_TRUE()` to check a
complex expression, for lack of a better macro. This has the problem of not
showing you the values of the parts of the expression, making it hard to
understand what went wrong. As a workaround, some users choose to construct the
failure message by themselves, streaming it into `EXPECT_TRUE()`. However, this
is awkward especially when the expression has side-effects or is expensive to
evaluate.

googletest gives you three different options to solve this problem:

#### Using an Existing Boolean Function

If you already have a function or functor that returns `bool` (or a type that
can be implicitly converted to `bool`), you can use it in a *predicate
assertion* to get the function arguments printed for free:

<!-- mdformat off(github rendering does not support multiline tables) -->

| Fatal assertion                   | Nonfatal assertion                | Verifies                    |
| --------------------------------- | --------------------------------- | --------------------------- |
| `ASSERT_PRED1(pred1, val1)`       | `EXPECT_PRED1(pred1, val1)`       | `pred1(val1)` is true       |
| `ASSERT_PRED2(pred2, val1, val2)` | `EXPECT_PRED2(pred2, val1, val2)` | `pred2(val1, val2)` is true |
| `...`                             | `...`                             | `...`                       |

<!-- mdformat on-->
In the above, `predn` is an `n`-ary predicate function or functor, where `val1`,
`val2`, ..., and `valn` are its arguments. The assertion succeeds if the
predicate returns `true` when applied to the given arguments, and fails
otherwise. When the assertion fails, it prints the value of each argument. In
either case, the arguments are evaluated exactly once.

Here's an example. Given

```c++
// Returns true if m and n have no common divisors except 1.
bool MutuallyPrime(int m, int n) { ... }

const int a = 3;
const int b = 4;
const int c = 10;
```

the assertion

```c++
  EXPECT_PRED2(MutuallyPrime, a, b);
```

will succeed, while the assertion

```c++
  EXPECT_PRED2(MutuallyPrime, b, c);
```

will fail with the message

```none
MutuallyPrime(b, c) is false, where
b is 4
c is 10
```

> NOTE:
>
> 1.  If you see a compiler error "no matching function to call" when using
>     `ASSERT_PRED*` or `EXPECT_PRED*`, please see
>     [this](faq.md#the-compiler-complains-no-matching-function-to-call-when-i-use-assert-pred-how-do-i-fix-it)
>     for how to resolve it.

#### Using a Function That Returns an AssertionResult

While `EXPECT_PRED*()` and friends are handy for a quick job, the syntax is not
satisfactory: you have to use different macros for different arities, and it
feels more like Lisp than C++. The `::testing::AssertionResult` class solves
this problem.

An `AssertionResult` object represents the result of an assertion (whether it's
a success or a failure, and an associated message). You can create an
`AssertionResult` using one of these factory functions:

```c++
namespace testing {

// Returns an AssertionResult object to indicate that an assertion has
// succeeded.
AssertionResult AssertionSuccess();

// Returns an AssertionResult object to indicate that an assertion has
// failed.
AssertionResult AssertionFailure();

}
```

You can then use the `<<` operator to stream messages to the `AssertionResult`
object.

To provide more readable messages in Boolean assertions (e.g. `EXPECT_TRUE()`),
write a predicate function that returns `AssertionResult` instead of `bool`. For
example, if you define `IsEven()` as:

```c++
::testing::AssertionResult IsEven(int n) {
  if ((n % 2) == 0)
     return ::testing::AssertionSuccess();
  else
     return ::testing::AssertionFailure() << n << " is odd";
}
```

instead of:

```c++
bool IsEven(int n) {
  return (n % 2) == 0;
}
```

the failed assertion `EXPECT_TRUE(IsEven(Fib(4)))` will print:

```none
Value of: IsEven(Fib(4))
  Actual: false (3 is odd)
Expected: true
```

instead of a more opaque

```none
Value of: IsEven(Fib(4))
  Actual: false
Expected: true
```

If you want informative messages in `EXPECT_FALSE` and `ASSERT_FALSE` as well
(one third of Boolean assertions in the Google code base are negative ones), and
are fine with making the predicate slower in the success case, you can supply a
success message:

```c++
::testing::AssertionResult IsEven(int n) {
  if ((n % 2) == 0)
     return ::testing::AssertionSuccess() << n << " is even";
  else
     return ::testing::AssertionFailure() << n << " is odd";
}
```

Then the statement `EXPECT_FALSE(IsEven(Fib(6)))` will print

```none
  Value of: IsEven(Fib(6))
     Actual: true (8 is even)
  Expected: false
```

#### Using a Predicate-Formatter

If you find the default message generated by `(ASSERT|EXPECT)_PRED*` and
`(ASSERT|EXPECT)_(TRUE|FALSE)` unsatisfactory, or some arguments to your
predicate do not support streaming to `ostream`, you can instead use the
following *predicate-formatter assertions* to *fully* customize how the message
is formatted:

Fatal assertion                                  | Nonfatal assertion                               | Verifies
------------------------------------------------ | ------------------------------------------------ | --------
`ASSERT_PRED_FORMAT1(pred_format1, val1);`       | `EXPECT_PRED_FORMAT1(pred_format1, val1);`       | `pred_format1(val1)` is successful
`ASSERT_PRED_FORMAT2(pred_format2, val1, val2);` | `EXPECT_PRED_FORMAT2(pred_format2, val1, val2);` | `pred_format2(val1, val2)` is successful
`...`                                            | `...`                                            | ...