summaryrefslogtreecommitdiff
path: root/libraries/ArduinoTestSuite/examples/ATS_Constants/ATS_Constants.pde
blob: 44cd1f884fd6cfa4324d183215bbff18dcd7971c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
//************************************************************************
//*	Arduino Test of Arduino Constants 
//*		(C) 2010 by Rick Anderson
//*		Open source as per standard Arduino code
//*
//************************************************************************
//*	Oct 16,	2010	<ROA>  Test of Arduino Constants
//************************************************************************

#include	"WProgram.h"
#include	"HardwareSerial.h"
#include	<ArduinoTestSuite.h>

//************************************************************************
void setup()
{
  int		startMemoryUsage;

 //Start memory usage must be site prior to ATS_begin
  startMemoryUsage	=	ATS_GetFreeMemory();
  ATS_begin("Arduino", "Test of Arduino Constants");
  /*
   * Test Run Start
   */


  //test true constant
  ATS_PrintTestStatus("1. Test of true constant", true == 1);

  //test false consts
  ATS_PrintTestStatus( "2. Test of false constant", false == 0);

  //Test of HIGH == 1
  ATS_PrintTestStatus( "3. Test of HIGH == 1", HIGH == 1);

  //Test of LOW ==  0
  ATS_PrintTestStatus( "4. Test of LOW ==  0", LOW == 0);

  //Test of INPUT == 1
  ATS_PrintTestStatus( "5. Test of INPUT == 1", HIGH == 1);

  //Test of OUTPUT ==  0
  ATS_PrintTestStatus( "6. Test of OUTPUT ==  0", LOW == 0);

  //test decimal
  ATS_PrintTestStatus( "7. Test of decimal constant", 101 == ((1 * pow(10,2)) + (0 * pow(10,1)) + 1));

  //test binary
  ATS_PrintTestStatus( "8. Test of binary constant", B101 == 5);

  //test octal
  ATS_PrintTestStatus( "9. Test of octal constant", 0101 == 65);

  //test hexadecimal
  ATS_PrintTestStatus( "7. Test of hexadecimal constant", (0x101 == 257));

  /*
  * Test Run End
   */
  ATS_ReportMemoryUsage(startMemoryUsage);
  ATS_end();

}


//************************************************************************
void loop()
{


}